diff options
Diffstat (limited to 'common')
| -rw-r--r-- | common/compat.c | 3 | ||||
| -rw-r--r-- | common/config-parser.c | 1 | ||||
| -rw-r--r-- | common/config-parser.h | 2 | ||||
| -rw-r--r-- | common/hash.c | 1 | ||||
| -rw-r--r-- | common/server-mainloop.c | 18 | 
5 files changed, 11 insertions, 14 deletions
| diff --git a/common/compat.c b/common/compat.c index 247560e..67d3997 100644 --- a/common/compat.c +++ b/common/compat.c @@ -42,6 +42,7 @@  #include <syslog.h>  #include <stdlib.h>  #include <stdio.h> +#include <err.h>  #include <strings.h>  #include "usuals.h" @@ -238,7 +239,7 @@ xcalloc(size_t size)  {      register void* value = calloc(1, size);      if(value == NULL) -        errx("out of memory"); +        errx(1, "out of memory");      return value;  } diff --git a/common/config-parser.c b/common/config-parser.c index 5c1aa98..10bf20f 100644 --- a/common/config-parser.c +++ b/common/config-parser.c @@ -121,7 +121,6 @@ cfg_parse_file(const char* filename, void* data, char** memory)      int ret = -1;      char* p;      char* t; -    int pos;      ASSERT(filename); diff --git a/common/config-parser.h b/common/config-parser.h index 94d96c9..174bac2 100644 --- a/common/config-parser.h +++ b/common/config-parser.h @@ -41,7 +41,7 @@  /* Callbacks must be defined by the caller */  extern int cfg_value(const char* filename, const char* header, const char* name,                       char* value, void* data); -extern int cfg_errcallback(const char* filename, const char* errmsg, void* data); +extern int cfg_error(const char* filename, const char* errmsg, void* data);  /* Calling these will call the callbacks above */  int cfg_parse_dir(const char* dirname, void* data); diff --git a/common/hash.c b/common/hash.c index 789e85c..c99a689 100644 --- a/common/hash.c +++ b/common/hash.c @@ -53,6 +53,7 @@  #include <sys/types.h>  #include <stdlib.h> +#include <string.h>  #include "hash.h"  #define KEY_DATA(he)    ((he)->key) diff --git a/common/server-mainloop.c b/common/server-mainloop.c index 07f02b2..6ea8985 100644 --- a/common/server-mainloop.c +++ b/common/server-mainloop.c @@ -97,18 +97,14 @@ timeval_compare(struct timeval* t1, struct timeval* t2)  #define timeval_to_ms(tv) \      ((((uint64_t)(tv).tv_sec) * 1000L) + (((uint64_t)(tv).tv_usec) / 1000L)) -static int -timeval_dump(struct timeval* tv) -{ -    fprintf(stderr, "{ %d:%d }", tv->tv_sec, tv->tv_usec / 1000); -} +#define timeval_dump(tv) \ +    (fprintf(stderr, "{ %d:%d }", (uint)((tv)->tv_sec), (uint)((tv)->tv_usec / 1000))  static int  add_timer(int ms, int oneshot, server_timer_callback callback, void* arg)  {      struct timeval interval;      timer_callback* cb; -    int i;      ASSERT(ms > 0);      ASSERT(callback != NULL); @@ -150,10 +146,9 @@ remove_timer(timer_callback* timcb)  {      timer_callback* cb;      timer_callback* next; -    int i;      if(!ctx.timers) -        return; +        return NULL;      /* First in list */;      if(ctx.timers == timcb) @@ -175,6 +170,9 @@ remove_timer(timer_callback* timcb)              return cb->next;          }      } + +    /* Couldn't remove, return self */ +    return timcb;  }  void @@ -232,7 +230,7 @@ server_run()      timer_callback* timcb;      socket_callback* sockcb;      fd_set rfds, wfds; -    int r, i; +    int r;      /* No watches have been set */      ASSERT(ctx.max_fd > -1); @@ -346,7 +344,6 @@ int  server_watch(int fd, int type, server_socket_callback callback, void* arg)  {      socket_callback* cb; -    int i;      ASSERT(type != 0);      ASSERT(fd != -1);      ASSERT(callback != NULL); @@ -380,7 +377,6 @@ void  server_unwatch(int fd)  {      socket_callback* cb; -    int i;      ASSERT(fd != -1); | 
