src/main.c (main): Remove call to timeq_init().
src/timeq.h (timeq_init): Remove declaration.
src/timeq.c (timeq_cleanup): Assign NULL to timeq to handle late timeq_del() calls.
(timeq_init): Make static.
(timeq_next): If timeq is NULL, return a large positive number.
(timeq_add): If timeq is NULL, initialize it.
(timeq_del): If timeq is NULL, do nothing.
git-archimport-id: srvx@srvx.net--2006/srvx--devo--1.3--patch-54
# arch-tag: automatic-ChangeLog--srvx@srvx.net--2006/srvx--devo--1.3
#
+2006-10-04 01:41:05 GMT Michael Poole <mdpoole@troilus.org> patch-54
+
+ Summary:
+ Make timeq_init() automatic.
+ Revision:
+ srvx--devo--1.3--patch-54
+
+ src/main.c (main): Remove call to timeq_init().
+
+ src/timeq.h (timeq_init): Remove declaration.
+
+ src/timeq.c (timeq_cleanup): Assign NULL to timeq to handle late timeq_del() calls.
+ (timeq_init): Make static.
+ (timeq_next): If timeq is NULL, return a large positive number.
+ (timeq_add): If timeq is NULL, initialize it.
+ (timeq_del): If timeq is NULL, do nothing.
+
+ modified files:
+ ChangeLog src/main.c src/timeq.c src/timeq.h
+
+
2006-10-04 01:37:40 GMT Michael Poole <mdpoole@troilus.org> patch-53
Summary:
MAIN_LOG = log_register_type("srvx", "file:main.log");
if (debug)
log_debug();
- timeq_init();
ioset_init();
init_structs();
init_parse();
{
timeq_del(0, 0, 0, TIMEQ_IGNORE_WHEN|TIMEQ_IGNORE_FUNC|TIMEQ_IGNORE_DATA);
heap_delete(timeq);
+ timeq = NULL;
}
-void
+static void
timeq_init(void)
{
timeq = heap_new(int_comparator);
timeq_next(void)
{
void *time;
+ if (!timeq)
+ return ~0;
heap_peek(timeq, &time, 0);
return (time_t)time;
}
ent->func = func;
ent->data = data;
w = (void*)when;
+ if (!timeq)
+ timeq_init();
heap_insert(timeq, w, ent);
}
extra.func = func;
extra.data = data;
extra.mask = mask;
- heap_remove_pred(timeq, timeq_del_matching, &extra);
+ if (timeq)
+ heap_remove_pred(timeq, timeq_del_matching, &extra);
}
unsigned int
#define TIMEQ_IGNORE_FUNC 0x02
#define TIMEQ_IGNORE_DATA 0x04
-void timeq_init(void);
void timeq_add(time_t when, timeq_func func, void *data);
void timeq_del(time_t when, timeq_func func, void *data, int mask);
time_t timeq_next(void);