summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1997-04-20 16:38:22 +0000
committerbde <bde@FreeBSD.org>1997-04-20 16:38:22 +0000
commit2d072e5f9d207912f63db40b062677c0507dbed5 (patch)
tree6d83d2dd376c810b976b23a5441a3003276ab4e3
parent8784b3f4e891adb70e9eeb6b8e2a04741912409d (diff)
downloadFreeBSD-src-2d072e5f9d207912f63db40b062677c0507dbed5.zip
FreeBSD-src-2d072e5f9d207912f63db40b062677c0507dbed5.tar.gz
Fixed the type of timeout functions and removed casts that hid the
type mismatches. There was no problem in practice (at least on 386's). Don't cast NULL in calls to timeout functions. pcvt is fully prototyped and doesn't support K&R. Timeout functions take args of type `void *', so use magic numbers of type `void *' for UPDATE_* to reduce the danger of wrong conversions. Removed FreeBSD-pre-1.1-related TIMEOUT_FUNC_T macro. It was especially bogus for the pre-1.1 case.
-rw-r--r--sys/i386/isa/pcvt/pcvt_drv.c5
-rw-r--r--sys/i386/isa/pcvt/pcvt_hdr.h16
-rw-r--r--sys/i386/isa/pcvt/pcvt_kbd.c4
-rw-r--r--sys/i386/isa/pcvt/pcvt_sup.c32
4 files changed, 24 insertions, 33 deletions
diff --git a/sys/i386/isa/pcvt/pcvt_drv.c b/sys/i386/isa/pcvt/pcvt_drv.c
index 506603a..10a93b8 100644
--- a/sys/i386/isa/pcvt/pcvt_drv.c
+++ b/sys/i386/isa/pcvt/pcvt_drv.c
@@ -776,7 +776,8 @@ int pcvt_kbd_rptr = 0;
short pcvt_kbd_count= 0;
static u_char pcvt_timeout_scheduled = 0;
-static void pcvt_timeout (void *arg)
+static void
+pcvt_timeout(void *arg)
{
u_char *cp;
@@ -891,7 +892,7 @@ pcrint(int unit)
{
PCVT_DISABLE_INTR ();
pcvt_timeout_scheduled = 1; /* flag active */
- timeout((TIMEOUT_FUNC_T)pcvt_timeout, (caddr_t) 0, 1); /* fire off */
+ timeout(pcvt_timeout, NULL, hz / 100); /* fire off */
PCVT_ENABLE_INTR ();
}
}
diff --git a/sys/i386/isa/pcvt/pcvt_hdr.h b/sys/i386/isa/pcvt/pcvt_hdr.h
index b33ceba..533e588 100644
--- a/sys/i386/isa/pcvt/pcvt_hdr.h
+++ b/sys/i386/isa/pcvt/pcvt_hdr.h
@@ -731,9 +731,9 @@ in the config file"
/* arguments to async_update() */
-#define UPDATE_START 0 /* do cursor update and requeue */
-#define UPDATE_STOP 1 /* suspend cursor updates */
-#define UPDATE_KERN 2 /* do cursor updates for kernel output */
+#define UPDATE_START ((void *)0) /* do cursor update and requeue */
+#define UPDATE_STOP ((void *)1) /* suspend cursor updates */
+#define UPDATE_KERN ((void *)2) /* do cursor updates for kernel output */
/* variables */
@@ -1204,14 +1204,6 @@ extern u_char *saved_charsets[NVGAFONTS];
#define Dev_t dev_t
#endif
-/* in FreeBSD > 102 arguments for timeout()/untimeout() are a special type */
-
-#if PCVT_FREEBSD > 102
-#define TIMEOUT_FUNC_T timeout_func_t
-#else
-#define TIMEOUT_FUNC_T void *
-#endif
-
#if !PCVT_FREEBSD || (PCVT_FREEBSD < 210)
extern void bcopyb(void *from, void *to, u_int length);
#endif
@@ -1267,7 +1259,7 @@ void pcvt_set_scrnsv_tmo ( int );
void vga_move_charset ( unsigned n, unsigned char *b, int save_it);
-void async_update ( int arg );
+void async_update ( void *arg );
void clr_parms ( struct video_state *svsp );
void cons_highlight ( void );
void cons_normal ( void );
diff --git a/sys/i386/isa/pcvt/pcvt_kbd.c b/sys/i386/isa/pcvt/pcvt_kbd.c
index e5c46df..4b15094 100644
--- a/sys/i386/isa/pcvt/pcvt_kbd.c
+++ b/sys/i386/isa/pcvt/pcvt_kbd.c
@@ -309,9 +309,9 @@ update_led(void)
#if PCVT_UPDLED_LOSES_INTR
if (lost_intr_timeout_queued)
- untimeout (check_for_lost_intr, (void *)NULL);
+ untimeout(check_for_lost_intr, NULL);
- timeout (check_for_lost_intr, (void *)NULL, hz);
+ timeout(check_for_lost_intr, NULL, hz);
lost_intr_timeout_queued = 1;
#endif /* PCVT_UPDLED_LOSES_INTR */
diff --git a/sys/i386/isa/pcvt/pcvt_sup.c b/sys/i386/isa/pcvt/pcvt_sup.c
index 3686e91..b04a459 100644
--- a/sys/i386/isa/pcvt/pcvt_sup.c
+++ b/sys/i386/isa/pcvt/pcvt_sup.c
@@ -96,7 +96,7 @@ static void pcvt_set_scrnsv_tmo ( int timeout );/* else declared global */
#if PCVT_PRETTYSCRNS
static u_short *scrnsv_current = (u_short *)0; /* attention char ptr */
-static void scrnsv_blink ( void );
+static void scrnsv_blink ( void * );
static u_short getrand ( void );
#endif /* PCVT_PRETTYSCRNS */
@@ -881,13 +881,13 @@ vgapaletteio(unsigned idx, struct rgb *val, int writeit)
* update asynchronous: cursor, cursor pos displ, sys load, keyb scan
*
* arg is:
- * UPDATE_START = 0 = do update; requeue
- * UPDATE_STOP = 1 = suspend updates
- * UPDATE_KERN = 2 = do update for kernel printfs
+ * UPDATE_START = do update; requeue
+ * UPDATE_STOP = suspend updates
+ * UPDATE_KERN = do update for kernel printfs
*
*---------------------------------------------------------------------------*/
void
-async_update(int arg)
+async_update(void *arg)
{
static int lastpos = 0;
static int counter = PCVT_UPDATESLOW;
@@ -897,7 +897,7 @@ async_update(int arg)
if(arg == UPDATE_STOP)
{
- untimeout((TIMEOUT_FUNC_T)async_update, UPDATE_START);
+ untimeout(async_update, UPDATE_START);
return;
}
#endif /* XSERVER */
@@ -1082,7 +1082,7 @@ async_update_exit:
if(arg == UPDATE_START)
{
- timeout((TIMEOUT_FUNC_T)async_update, UPDATE_START, PCVT_UPDATEFAST);
+ timeout(async_update, UPDATE_START, PCVT_UPDATEFAST);
}
}
@@ -1921,7 +1921,7 @@ getrand(void)
* produce "nice" screensaving ....
*---------------------------------------------------------------------------*/
static void
-scrnsv_blink(void)
+scrnsv_blink(void * arg)
{
static struct rgb blink_rgb[8] =
{
@@ -1942,7 +1942,7 @@ scrnsv_blink(void)
*scrnsv_current = (7 /* LIGHTGRAY */ << 8) + '*';
if(adaptor_type == VGA_ADAPTOR)
vgapaletteio(7 /* LIGHTGRAY */, &blink_rgb[(r >> 4) & 7], 1);
- timeout((TIMEOUT_FUNC_T)scrnsv_blink, NULL, hz);
+ timeout(scrnsv_blink, NULL, hz);
}
#endif /* PCVT_PRETTYSCRNS */
@@ -1961,7 +1961,7 @@ pcvt_set_scrnsv_tmo(int timeout)
int x = splhigh();
if(scrnsv_timeout)
- untimeout((TIMEOUT_FUNC_T)scrnsv_timedout, NULL);
+ untimeout(scrnsv_timedout, NULL);
scrnsv_timeout = timeout;
pcvt_scrnsv_reset(); /* sanity */
@@ -2038,8 +2038,7 @@ scrnsv_timedout(void *arg)
vgapaletteio(0 /* BLACK */, &black, 1);
}
/* prepare for next time... */
- timeout((TIMEOUT_FUNC_T)scrnsv_timedout /* me! */,
- NULL, hz / 10);
+ timeout(scrnsv_timedout, NULL, hz / 10);
}
else
{
@@ -2049,7 +2048,7 @@ scrnsv_timedout(void *arg)
#if PCVT_PRETTYSCRNS
scrnsv_current = vsp->Crtat;
- timeout((TIMEOUT_FUNC_T)scrnsv_blink, NULL, hz);
+ timeout(scrnsv_blink, NULL, hz);
#endif /* PCVT_PRETTYSCRNS */
sw_cursor(0); /* cursor off on mda/cga */
@@ -2077,14 +2076,14 @@ pcvt_scrnsv_reset(void)
{
last_schedule = time.tv_sec;
reschedule = 1;
- untimeout((TIMEOUT_FUNC_T)scrnsv_timedout, NULL);
+ untimeout(scrnsv_timedout, NULL);
}
if(scrnsv_active)
{
#if PCVT_PRETTYSCRNS
if(scrnsv_active > 1)
- untimeout((TIMEOUT_FUNC_T)scrnsv_blink, NULL);
+ untimeout(scrnsv_blink, NULL);
#endif /* PCVT_PRETTYSCRNS */
bcopy(savedscreen, vsp->Crtat, scrnsv_size);
@@ -2107,8 +2106,7 @@ pcvt_scrnsv_reset(void)
if(reschedule)
{
/* mark next timeout */
- timeout((TIMEOUT_FUNC_T)scrnsv_timedout, NULL,
- scrnsv_timeout * hz);
+ timeout(scrnsv_timedout, NULL, scrnsv_timeout * hz);
}
splx(x);
}
OpenPOWER on IntegriCloud