From 921693c44eb20c37ef2d281cafcd242f600b0460 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sat, 14 Jun 2008 17:42:05 +0000 Subject: [PATCH] Rename INPUT and OUTPUT to EVRPC_INPUT and EVRPC_OUTPUT, but keep the INPUT/OUTPUT aliases on non-win32 platforms to maintain backwards compatibility. svn:r851 --- ChangeLog | 2 ++ evrpc.c | 20 ++++++++++---------- evrpc.h | 13 +++++++++++-- test/regress_rpc.c | 6 +++--- 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9c1bab39..db184b25 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ Changes in 1.4.5-stable: o Fix use of freed memory in event_reinit; pointed out by Peter Postma o Constify struct timeval * where possible; pointed out by Forest Wilkinson o allow min_heap_erase to be called on removed members; from liusifan. + o Rename INPUT and OUTPUT to EVRPC_INPUT and EVRPC_OUTPUT. Retain INPUT/OUTPUT aliases on on-win32 platforms for backwards compatibility. + Changes in 1.4.4-stable: o Correct the documentation on buffer printf functions. diff --git a/evrpc.c b/evrpc.c index 32fbfa27..070fd9e7 100644 --- a/evrpc.c +++ b/evrpc.c @@ -88,10 +88,10 @@ evrpc_free(struct evrpc_base *base) assert(evrpc_unregister_rpc(base, rpc->uri)); } while ((hook = TAILQ_FIRST(&base->input_hooks)) != NULL) { - assert(evrpc_remove_hook(base, INPUT, hook)); + assert(evrpc_remove_hook(base, EVRPC_INPUT, hook)); } while ((hook = TAILQ_FIRST(&base->output_hooks)) != NULL) { - assert(evrpc_remove_hook(base, OUTPUT, hook)); + assert(evrpc_remove_hook(base, EVRPC_OUTPUT, hook)); } free(base); } @@ -106,14 +106,14 @@ evrpc_add_hook(void *vbase, struct evrpc_hook_list *head = NULL; struct evrpc_hook *hook = NULL; switch (hook_type) { - case INPUT: + case EVRPC_INPUT: head = &base->in_hooks; break; - case OUTPUT: + case EVRPC_OUTPUT: head = &base->out_hooks; break; default: - assert(hook_type == INPUT || hook_type == OUTPUT); + assert(hook_type == EVRPC_INPUT || hook_type == EVRPC_OUTPUT); } hook = calloc(1, sizeof(struct evrpc_hook)); @@ -151,14 +151,14 @@ evrpc_remove_hook(void *vbase, enum EVRPC_HOOK_TYPE hook_type, void *handle) struct _evrpc_hooks *base = vbase; struct evrpc_hook_list *head = NULL; switch (hook_type) { - case INPUT: + case EVRPC_INPUT: head = &base->in_hooks; break; - case OUTPUT: + case EVRPC_OUTPUT: head = &base->out_hooks; break; default: - assert(hook_type == INPUT || hook_type == OUTPUT); + assert(hook_type == EVRPC_INPUT || hook_type == EVRPC_OUTPUT); } return (evrpc_remove_hook_internal(head, handle)); @@ -424,11 +424,11 @@ evrpc_pool_free(struct evrpc_pool *pool) } while ((hook = TAILQ_FIRST(&pool->input_hooks)) != NULL) { - assert(evrpc_remove_hook(pool, INPUT, hook)); + assert(evrpc_remove_hook(pool, EVRPC_INPUT, hook)); } while ((hook = TAILQ_FIRST(&pool->output_hooks)) != NULL) { - assert(evrpc_remove_hook(pool, OUTPUT, hook)); + assert(evrpc_remove_hook(pool, EVRPC_OUTPUT, hook)); } free(pool); diff --git a/evrpc.h b/evrpc.h index 45f684ac..7c16b95c 100644 --- a/evrpc.h +++ b/evrpc.h @@ -436,10 +436,19 @@ void evrpc_pool_set_timeout(struct evrpc_pool *pool, int timeout_in_secs); */ enum EVRPC_HOOK_TYPE { - INPUT, /**< apply the function to an input hook */ - OUTPUT /**< apply the function to an output hook */ + EVRPC_INPUT, /**< apply the function to an input hook */ + EVRPC_OUTPUT /**< apply the function to an output hook */ }; +#ifndef WIN32 +/** Deprecated alias for EVRPC_INPUT. Not available on windows, where it + * conflicts with platform headers. */ +#define INPUT EVRPC_INPUT +/** Deprecated alias for EVRPC_OUTPUT. Not available on windows, where it + * conflicts with platform headers. */ +#define OUTPUT EVRPC_OUTPUT +#endif + /** adds a processing hook to either an rpc base or rpc pool * * If a hook returns -1, the processing is aborted. diff --git a/test/regress_rpc.c b/test/regress_rpc.c index 9fc1d50b..c80fb9d9 100644 --- a/test/regress_rpc.c +++ b/test/regress_rpc.c @@ -450,14 +450,14 @@ rpc_basic_client(void) need_input_hook = 1; need_output_hook = 1; - assert(evrpc_add_hook(base, INPUT, rpc_hook_add_header, (void*)"input") + assert(evrpc_add_hook(base, EVRPC_INPUT, rpc_hook_add_header, (void*)"input") != NULL); - assert(evrpc_add_hook(base, OUTPUT, rpc_hook_add_header, (void*)"output") + assert(evrpc_add_hook(base, EVRPC_OUTPUT, rpc_hook_add_header, (void*)"output") != NULL); pool = rpc_pool_with_connection(port); - assert(evrpc_add_hook(pool, INPUT, rpc_hook_remove_header, (void*)"output")); + assert(evrpc_add_hook(pool, EVRPC_INPUT, rpc_hook_remove_header, (void*)"output")); /* set up the basic message */ msg = msg_new();