diff --git a/Makefile.am b/Makefile.am index b611eacb818022936434f9075c1cdf9a56c2c689..6d42fb5fd23c37948749f8a3333ff28ce91656aa 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,6 +12,7 @@ INCLUDES = $(GLIB_INCLUDES) $(WWW_INCLUDES) # versions updated as of 0.4; 0.5 only changes build stuff; # 0.6 only adds the readline interface. +# 0.7 breaks compatibility (OOP_CONTINUE / OOP_HALT) liboop_la_LDFLAGS = -version-info 2:0:0 # version:revision:age liboop_la_SOURCES = sys.c select.c signal.c alloc.c @@ -43,6 +44,7 @@ release: dist ln -sf $(PACKAGE)-$(VERSION).tar.gz ../../gdist/$(PACKAGE).tar.gz ; \ ln -sf $(PACKAGE)-$(VERSION).tar.bz2 ../../gdist/$(PACKAGE).tar.bz2 ; \ fi + @echo '** NOW TAG THE CVS REPOSITORY! **' install-exec-local: $(PROG_LDCONFIG) || true diff --git a/acconfig.h b/acconfig.h index c02c5360a0a39adb38d48f641e32d4c791ccbf91..49647a69c766c8ee6c40999d9257653788209949 100644 --- a/acconfig.h +++ b/acconfig.h @@ -20,6 +20,9 @@ /* The glib utility library (from gtk+) */ #undef HAVE_GLIB +/* GNU readline */ +#undef HAVE_READLINE + /* The W3C libwww */ #undef HAVE_WWW diff --git a/adns.c b/adns.c index f290e6c6b9e5c285fa168fe7dbc57bebbbce76db..50d1c376e1c258a931a82bdfad9e16480b0d78bf 100644 --- a/adns.c +++ b/adns.c @@ -105,15 +105,12 @@ static void *on_process(oop_source *source,struct timeval when,void *data) { adns_answer *r; adns_query query; oop_adns_query *q = NULL; + void *adns_data; - adns_forallqueries_begin(a->state); - while (NULL == q - && (query = adns_forallqueries_next(a->state,NULL))) { - void *data; - if (0 == adns_check(a->state,&query,&r,&data)) { - q = (oop_adns_query *) data; - assert(query == q->query); - } + query = NULL; + if (0 == adns_check(a->state,&query,&r,&adns_data)) { + q = (oop_adns_query *) adns_data; + assert(query == q->query); } set_select(a); diff --git a/configure.in b/configure.in index 80f751febe0dbf3c915bb6549c6da97876c2e61e..9ad40a97de06a4c50ac0a825d04a5b6a9760ff95 100644 --- a/configure.in +++ b/configure.in @@ -60,6 +60,9 @@ if test -z "$no_wacky_libs" ; then AC_CHECK_LIB(socket,socket) fi +test yes = "$GCC" && +CFLAGS="-Wall -Wno-comment -Werror -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Wwrite-strings $CFLAGS" + AC_SUBST(PROG_LDCONFIG) AC_SUBST(GLIB_INCLUDES) AC_SUBST(GLIB_LIBS) diff --git a/glib.c b/glib.c index 942a24afbc06eba17806741dc33a88a6b4870e8c..47160a6a552198f1fb773f7c111c48d46c7f9bb0 100644 --- a/glib.c +++ b/glib.c @@ -92,7 +92,7 @@ static gint real_poll(GPollFD *array,guint num,gint timeout) { } #endif -oop_source *oop_glib_new() { +oop_source *oop_glib_new(void) { if (use_count++) return oop_sys_source(sys); sys = oop_sys_new(); @@ -101,13 +101,13 @@ oop_source *oop_glib_new() { return oop_sys_source(sys); } -void *oop_glib_return() { +void *oop_glib_return(void) { if (&use_count == ret) return NULL; return ret; } #ifdef HAVE_POLL_H -void oop_glib_delete() { +void oop_glib_delete(void) { assert(use_count > 0 && "oop_glib_delete() called too much"); if (0 != --use_count) return; diff --git a/oop-glib.h b/oop-glib.h index 95776f79642f4cf0eb38203521ecc968c4ec200b..5252e59c5215f74c84d8b6615318dd2ac7c5ea9f 100644 --- a/oop-glib.h +++ b/oop-glib.h @@ -14,12 +14,12 @@ #include "oop.h" /* Create an event source based on the GLib event loop. */ -oop_source *oop_glib_new(); +oop_source *oop_glib_new(void); /* Delete the event source so created. (Uses reference counting.) */ -void oop_glib_delete(); +void oop_glib_delete(void); /* Get the value used to terminate the event loop (e.g. OOP_HALT). */ -void *oop_glib_return(); +void *oop_glib_return(void); #endif diff --git a/oop.h b/oop.h index a9552800b108536f560330f6ae808b9aa9437c10..6accaacb1f738dd4b3837cddeb5b09e88138ff58 100644 --- a/oop.h +++ b/oop.h @@ -31,8 +31,9 @@ static const struct timeval OOP_TIME_NOW = { 0, 0 }; #define OOP_NUM_SIGNALS 256 /* Callbacks may return one of these */ -#define OOP_CONTINUE NULL -#define OOP_HALT ((void *) 1) /* (or any non-NULL pointer of your choice) */ +extern int _oop_halt; /* internal only */ +#define OOP_CONTINUE ((void *) &_oop_halt) +#define OOP_HALT ((void *) NULL) /* (or any other value except OOP_CONTINUE) */ /* Callback function prototypes */ typedef void *oop_call_fd(oop_source *,int fd,oop_event,void *); diff --git a/sys.c b/sys.c index 68619282417d31fb6fffe16e780f267a1aa19cb9..3ed06714ffccee339201f7e3ab498f64d7487645 100644 --- a/sys.c +++ b/sys.c @@ -19,6 +19,8 @@ #include <sys/select.h> #endif +int _oop_halt; /* this has to go somewhere */ + #define MAGIC 0x9643 struct sys_time { diff --git a/test-oop.c b/test-oop.c index 49cc9be7b878fd20a78b473abdcdfd9a10fe175a..b6e16ab3750e22bdab339dec69ceaeafc5bcbb7f 100644 --- a/test-oop.c +++ b/test-oop.c @@ -23,6 +23,7 @@ GMainLoop *glib_loop; #ifdef HAVE_READLINE #include <readline/readline.h> +#include "oop-rl.h" #endif struct timer { @@ -59,8 +60,8 @@ static void usage(void) { /* -- timer ---------------------------------------------------------------- */ -oop_call_time on_timer; -void *on_timer(oop_source *source,struct timeval tv,void *data) { +static oop_call_time on_timer; +static void *on_timer(oop_source *source,struct timeval tv,void *data) { struct timer *timer = (struct timer *) data; timer->tv = tv; timer->tv.tv_sec += timer->delay; @@ -71,15 +72,15 @@ void *on_timer(oop_source *source,struct timeval tv,void *data) { return OOP_CONTINUE; } -oop_call_signal stop_timer; -void *stop_timer(oop_source *source,int sig,void *data) { +static oop_call_signal stop_timer; +static void *stop_timer(oop_source *source,int sig,void *data) { struct timer *timer = (struct timer *) data; source->cancel_time(source,timer->tv,on_timer,timer); source->cancel_signal(source,SIGQUIT,stop_timer,timer); return OOP_CONTINUE; } -void add_timer(oop_source *source,int interval) { +static void add_timer(oop_source *source,int interval) { struct timer *timer = malloc(sizeof(*timer)); gettimeofday(&timer->tv,NULL); timer->delay = interval; @@ -146,7 +147,9 @@ static void *stop_readline(oop_source *src,int sig,void *data) { } static void add_readline(oop_source *src) { - rl_callback_handler_install("> ",(VFunction *) on_readline); + rl_callback_handler_install( + (char *) "> ", /* readline isn't const-correct */ + (VFunction *) on_readline); oop_readline_register(src); src->on_signal(src,SIGQUIT,stop_readline,NULL); } @@ -298,7 +301,7 @@ static void *stop_www(oop_source *source,int sig,void *x) { return OOP_CONTINUE; } -void add_www(oop_source *source) { +static void add_www(oop_source *source) { puts("libwww: known bug: termination (^\\) may abort due to cached " "connections, sorry."); HTProfile_newNoCacheClient("test-www","1.0"); @@ -321,7 +324,7 @@ void add_www(oop_source *source) { #else -void add_www(oop_source *source) { +static void add_www(oop_source *source) { fputs("sorry, libwww not available\n",stderr); usage(); } @@ -413,26 +416,20 @@ static void add_sink(oop_source *src,const char *name) { return; } -#ifdef HAVE_READLINE if (!strcmp(name,"readline")) { add_readline(src); return; } -#endif -#ifdef HAVE_ADNS if (!strcmp(name,"adns")) { add_adns(src); return; } -#endif -#ifdef HAVE_WWW if (!strcmp(name,"libwww")) { add_www(src); return; } -#endif fprintf(stderr,"unknown sink \"%s\"\n",name); usage();