diff --git a/ChangeLog b/ChangeLog index c33b1e74..717afe39 100644 --- a/ChangeLog +++ b/ChangeLog @@ -108,6 +108,8 @@ Changes in current version: o change failing behavior of event_base_new_with_config: if a config is provided and no backend is selected, return NULL instead of aborting. o deliver partial data to request callbacks when chunked callback is set even if there is no chunking on the http level; allows cancelation of requests from within the chunked callback; from Scott Lamb. 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.0: o allow \r or \n individually to separate HTTP headers instead of the standard "\r\n"; from Charles Kerr. diff --git a/evrpc.c b/evrpc.c index 0add4fe3..fd3b93f0 100644 --- a/evrpc.c +++ b/evrpc.c @@ -97,10 +97,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)); } mm_free(base); } @@ -115,14 +115,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 = mm_calloc(1, sizeof(struct evrpc_hook)); @@ -160,14 +160,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)); @@ -525,11 +525,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)); } mm_free(pool); diff --git a/evrpc.h b/evrpc.h index 68aba172..5b52bb8e 100644 --- a/evrpc.h +++ b/evrpc.h @@ -429,10 +429,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 + /** * Return value from hook processing functions */ diff --git a/test/regress_rpc.c b/test/regress_rpc.c index d256725e..acbd83b2 100644 --- a/test/regress_rpc.c +++ b/test/regress_rpc.c @@ -474,15 +474,15 @@ 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, OUTPUT, rpc_hook_add_meta, NULL)); - assert(evrpc_add_hook(pool, INPUT, rpc_hook_remove_header, (void*)"output")); + assert(evrpc_add_hook(pool, EVRPC_OUTPUT, rpc_hook_add_meta, NULL)); + assert(evrpc_add_hook(pool, EVRPC_INPUT, rpc_hook_remove_header, (void*)"output")); /* set up the basic message */ msg = msg_new(); @@ -662,13 +662,13 @@ rpc_basic_client_with_pause(void) rpc_setup(&http, &port, &base); - assert(evrpc_add_hook(base, INPUT, rpc_hook_pause, base)); - assert(evrpc_add_hook(base, OUTPUT, rpc_hook_pause, base)); + assert(evrpc_add_hook(base, EVRPC_INPUT, rpc_hook_pause, base)); + assert(evrpc_add_hook(base, EVRPC_OUTPUT, rpc_hook_pause, base)); pool = rpc_pool_with_connection(port); - assert(evrpc_add_hook(pool, INPUT, rpc_hook_pause, pool)); - assert(evrpc_add_hook(pool, OUTPUT, rpc_hook_pause, pool)); + assert(evrpc_add_hook(pool, EVRPC_INPUT, rpc_hook_pause, pool)); + assert(evrpc_add_hook(pool, EVRPC_OUTPUT, rpc_hook_pause, pool)); /* set up the basic message */ msg = msg_new();