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
This commit is contained in:
Nick Mathewson 2008-06-14 17:42:05 +00:00
parent d5c3cdca20
commit 921693c44e
4 changed files with 26 additions and 15 deletions

View File

@ -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.

20
evrpc.c
View File

@ -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);

13
evrpc.h
View File

@ -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.

View File

@ -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();