Author: tjansen Date: Tue Oct 13 13:16:56 2009 New Revision: 1103 Log: Moved duplicate pisa_time_before() to util.c Modified: trunk/include/util.h trunk/libpisa/scheduler.c trunk/libpisa/util.c trunk/pisacd/cdpending.c Modified: trunk/include/util.h ============================================================================== --- trunk/include/util.h Tue Oct 13 13:01:37 2009 (r1102) +++ trunk/include/util.h Tue Oct 13 13:16:56 2009 (r1103) @@ -166,4 +166,7 @@ int pisa_convert_string_to_address(const char *str, struct in6_addr *ip6); void pisa_daemonize(void); + +int pisa_time_before(struct timeval *t1, struct timeval *t2); + #endif /* PISA_UTIL_H */ Modified: trunk/libpisa/scheduler.c ============================================================================== --- trunk/libpisa/scheduler.c Tue Oct 13 13:01:37 2009 (r1102) +++ trunk/libpisa/scheduler.c Tue Oct 13 13:16:56 2009 (r1103) @@ -14,6 +14,7 @@ #include <sys/time.h> #include "scheduler.h" +#include "util.h" /** * Our way to tell the main loop that we want to be called is setting the @@ -41,13 +42,6 @@ */ static int pipefd[2]; -static int pisa_time_before(struct timeval *t1, struct timeval *t2) -{ - if (t1->tv_sec == t2->tv_sec) - return t1->tv_usec < t2->tv_usec; - return t1->tv_sec < t2->tv_sec; -} - /** * Main function of the scheduler thread */ Modified: trunk/libpisa/util.c ============================================================================== --- trunk/libpisa/util.c Tue Oct 13 13:01:37 2009 (r1102) +++ trunk/libpisa/util.c Tue Oct 13 13:16:56 2009 (r1103) @@ -1172,3 +1172,16 @@ dup(result); dup(result); } + +/** + * Compares two timevals. + * @param t1 first timeval + * @param t2 second timeval + * @return t1 < t2 + */ +int pisa_time_before(struct timeval *t1, struct timeval *t2) +{ + if (t1->tv_sec == t2->tv_sec) + return t1->tv_usec < t2->tv_usec; + return t1->tv_sec < t2->tv_sec; +} Modified: trunk/pisacd/cdpending.c ============================================================================== --- trunk/pisacd/cdpending.c Tue Oct 13 13:01:37 2009 (r1102) +++ trunk/pisacd/cdpending.c Tue Oct 13 13:16:56 2009 (r1103) @@ -14,6 +14,7 @@ #include "debug.h" #include "cdpending.h" +#include "util.h" /** * Adds a number of microseconds to a timeval. @@ -31,19 +32,6 @@ } } -/** - * Compares two timevals. - * @param t1 first timeval - * @param t2 second timeval - * @return t1 < t2 - */ -static int pisa_time_before(struct timeval *t1, struct timeval *t2) -{ - if (t1->tv_sec == t2->tv_sec) - return t1->tv_usec < t2->tv_usec; - return t1->tv_sec < t2->tv_sec; -} - static pisa_pending *hash_pending = NULL; /**