From: Pierre Habouzit Date: Sat, 1 Sep 2007 10:59:53 +0000 (+0200) Subject: Refactoring. X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=c693c0b0d26eac89aef4e4c6740feca3627e2d26;p=apps%2Fpfixtools.git Refactoring. Signed-off-by: Pierre Habouzit --- diff --git a/buffer.h b/buffer.h index c94714d..c399259 100644 --- a/buffer.h +++ b/buffer.h @@ -33,8 +33,8 @@ * Copyright © 2006-2007 Pierre Habouzit */ -#ifndef POSTLICYD_BUFFER_H -#define POSTLICYD_BUFFER_H +#ifndef PFIXTOOLS_BUFFER_H +#define PFIXTOOLS_BUFFER_H #include "mem.h" #include "str.h" @@ -106,4 +106,4 @@ void buffer_consume(buffer_t *buf, ssize_t len); ssize_t buffer_read(buffer_t *buf, int fd, ssize_t count); -#endif /* POSTLICYD_BUFFER_H */ +#endif /* PFIXTOOLS_BUFFER_H */ diff --git a/common.c b/common.c index eba691b..0d7671d 100644 --- a/common.c +++ b/common.c @@ -40,7 +40,6 @@ #include "common.h" -sig_atomic_t cleanexit = false; sig_atomic_t sigint = false; sig_atomic_t sighup = false; diff --git a/common.h b/common.h index 207ca6e..6e76557 100644 --- a/common.h +++ b/common.h @@ -33,8 +33,8 @@ * Copyright © 2007 Pierre Habouzit */ -#ifndef POSTLICYD_H -#define POSTLICYD_H +#ifndef PFIXTOOLS_H +#define PFIXTOOLS_H #include #include @@ -64,7 +64,6 @@ typedef void (*exitcall_t)(void); #define module_exit(fn) static exitcall_t __exit_##fn __exit = fn; /* common.c */ -extern sig_atomic_t cleanexit; extern sig_atomic_t sigint; extern sig_atomic_t sighup; diff --git a/main-postlicyd.c b/main-postlicyd.c index b81a813..6810bba 100644 --- a/main-postlicyd.c +++ b/main-postlicyd.c @@ -39,7 +39,7 @@ #include "common.h" -volatile int nbthreads = 0; +/* administrivia {{{ */ static int main_initialize(void) { @@ -52,6 +52,16 @@ static int main_initialize(void) return 0; } +static void main_shutdown(void) +{ + closelog(); +} + +module_init(main_initialize); +module_exit(main_shutdown); + +/* }}} */ + void *job_run(void *_fd) { int fd = (intptr_t)_fd; @@ -84,14 +94,6 @@ static void main_loop(void) close(sock); } -static void main_shutdown(void) -{ - closelog(); -} - -module_init(main_initialize); -module_exit(main_shutdown); - int main(void) { if (atexit(common_shutdown)) { @@ -101,6 +103,6 @@ int main(void) common_initialize(); main_loop(); - syslog(LOG_INFO, cleanexit ? "Stopping..." : "Unclean exit..."); + syslog(LOG_INFO, "Stopping..."); return EXIT_SUCCESS; } diff --git a/mem.h b/mem.h index de11a59..ae69575 100644 --- a/mem.h +++ b/mem.h @@ -33,8 +33,8 @@ * Copyright © 2006 Pierre Habouzit */ -#ifndef POSTLICYD_MEM_H -#define POSTLICYD_MEM_H +#ifndef PFIXTOOLS_MEM_H +#define PFIXTOOLS_MEM_H #include #include @@ -131,4 +131,4 @@ static inline void *xmemdupstr(const void *src, ssize_t len) { } \ } -#endif /* POSTLICYD_MEM_H */ +#endif /* PFIXTOOLS_MEM_H */ diff --git a/postfix.h b/postfix.h index 4d038e8..88e4f8d 100644 --- a/postfix.h +++ b/postfix.h @@ -33,8 +33,8 @@ * Copyright © 2006-2007 Pierre Habouzit */ -#ifndef POSTLICYD_POSTFIX_H -#define POSTLICYD_POSTFIX_H +#ifndef PFIXTOOLS_POSTFIX_H +#define PFIXTOOLS_POSTFIX_H #include diff --git a/rbl.h b/rbl.h index ce3f7cf..af342e4 100644 --- a/rbl.h +++ b/rbl.h @@ -33,8 +33,8 @@ * Copyright © 2007 Pierre Habouzit */ -#ifndef POSTLICYD_RBL_H -#define POSTLICYD_RBL_H +#ifndef PFIXTOOLS_RBL_H +#define PFIXTOOLS_RBL_H typedef struct rbldb_t rbldb_t; diff --git a/str.h b/str.h index f6980e4..bc1cf9e 100644 --- a/str.h +++ b/str.h @@ -33,8 +33,8 @@ * Copyright © 2006 Pierre Habouzit */ -#ifndef POSTLICYD_STR_H -#define POSTLICYD_STR_H +#ifndef PFIXTOOLS_STR_H +#define PFIXTOOLS_STR_H #include "mem.h" @@ -372,4 +372,4 @@ m_stristr(const char *haystack, const char *needle) { } /*@}*/ -#endif /* POSTLICYD_STR_H */ +#endif /* PFIXTOOLS_STR_H */ diff --git a/tokens.sh b/tokens.sh index e402f48..05b70c0 100755 --- a/tokens.sh +++ b/tokens.sh @@ -46,8 +46,8 @@ EOF do_h() { do_hdr cat <