diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-03-21 20:25:34 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-03-21 20:25:34 +0000 |
| commit | 0a69cfc6d2cf672634e95d5eb2015434dd924abc (patch) | |
| tree | ef28312c548d2df4aa44b3e4cd29490427234767 /openbox | |
| parent | b10548f0ddf7ac9deb85372332686c6d8651a1f6 (diff) | |
add strict ansi compliance
Diffstat (limited to 'openbox')
| -rw-r--r-- | openbox/event.c | 3 | ||||
| -rw-r--r-- | openbox/openbox.c | 5 | ||||
| -rw-r--r-- | openbox/plugin.c | 4 | ||||
| -rw-r--r-- | openbox/timer.c | 13 |
4 files changed, 17 insertions, 8 deletions
diff --git a/openbox/event.c b/openbox/event.c index 68615fac..97e1412f 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -15,6 +15,9 @@ #include <X11/Xlib.h> #include <X11/keysym.h> #include <X11/Xatom.h> +#ifdef HAVE_SYS_SELECT_H +# include <sys/select.h> +#endif static void event_process(XEvent *e); static void event_handle_root(XEvent *e); diff --git a/openbox/openbox.c b/openbox/openbox.c index a4f527b1..04e07ab6 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -19,9 +19,6 @@ #ifdef HAVE_FCNTL_H # include <fcntl.h> #endif -#ifdef HAVE_SYS_SELECT_H -# include <sys/select.h> -#endif #ifdef HAVE_SIGNAL_H # include <signal.h> #endif @@ -78,7 +75,7 @@ int main(int argc, char **argv) sigemptyset(&sigset); action.sa_handler = dispatch_signal; action.sa_mask = sigset; - action.sa_flags = SA_NOCLDSTOP | SA_NODEFER; + action.sa_flags = SA_NOCLDSTOP; sigaction(SIGUSR1, &action, (struct sigaction *) NULL); sigaction(SIGPIPE, &action, (struct sigaction *) NULL); sigaction(SIGSEGV, &action, (struct sigaction *) NULL); diff --git a/openbox/plugin.c b/openbox/plugin.c index 247d490a..a8556fc7 100644 --- a/openbox/plugin.c +++ b/openbox/plugin.c @@ -46,8 +46,8 @@ static Plugin *plugin_new(char *name) return NULL; } - p->startup = load_sym(p->module, name, "plugin_startup"); - p->shutdown = load_sym(p->module, name, "plugin_shutdown"); + p->startup = (PluginStartup)load_sym(p->module, name, "plugin_startup"); + p->shutdown = (PluginShutdown)load_sym(p->module, name, "plugin_shutdown"); if (p->startup == NULL || p->shutdown == NULL) { g_module_close(p->module); diff --git a/openbox/timer.c b/openbox/timer.c index 0cec366f..b6a82cd3 100644 --- a/openbox/timer.c +++ b/openbox/timer.c @@ -10,12 +10,21 @@ static GSList *timers; /* nearest timer is at the top */ #define NEAREST_TIMEOUT (((Timer*)timers->data)->timeout) +static long timecompare(GTimeVal *a, GTimeVal *b) +{ + long r; + + if ((r = b->tv_sec - a->tv_sec)) return r; + return b->tv_usec - a->tv_sec; + +} + static void insert_timer(Timer *self) { GSList *it; for (it = timers; it != NULL; it = it->next) { Timer *t = it->data; - if (!timercmp(&self->timeout, &t->timeout, >)) { + if (timecompare(&self->timeout, &t->timeout) <= 0) { timers = g_slist_insert_before(timers, it, self); break; } @@ -99,7 +108,7 @@ void timer_dispatch(GTimeVal **wait) /* the queue is sorted, so if this timer shouldn't fire, none are ready */ - if (!timercmp(&now, &NEAREST_TIMEOUT, >)) + if (timecompare(&now, &NEAREST_TIMEOUT) <= 0) break; /* we set the last fired time to delay msec after the previous firing, |
