changeset 1194:90d1222a65a8

Rename HOOK_PEER_LAST to HOOK_LAST
author Sebastien Decugis <sdecugis@freediameter.net>
date Tue, 11 Jun 2013 14:04:40 +0800
parents dcc467aeda12
children 16f2d2f15e5b
files include/freeDiameter/libfdcore.h libfdcore/hooks.c
diffstat 2 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/include/freeDiameter/libfdcore.h	Tue Jun 11 14:03:36 2013 +0800
+++ b/include/freeDiameter/libfdcore.h	Tue Jun 11 14:04:40 2013 +0800
@@ -1046,7 +1046,7 @@
 		 - {permsgdata} is always NULL for this hook.
 		 */
 	
-#define HOOK_PEER_LAST	HOOK_PEER_CONNECT_SUCCESS
+#define HOOK_LAST	HOOK_PEER_CONNECT_SUCCESS
 };
 
 
--- a/libfdcore/hooks.c	Tue Jun 11 14:03:36 2013 +0800
+++ b/libfdcore/hooks.c	Tue Jun 11 14:04:40 2013 +0800
@@ -55,7 +55,7 @@
 
 /* Now a hook registered by an extension */
 struct fd_hook_hdl {
-	struct fd_list chain[HOOK_PEER_LAST+1];
+	struct fd_list chain[HOOK_LAST+1];
 	void (*fd_hook_cb)(enum fd_hook_type type, struct msg * msg, struct peer_hdr * peer, void * other, struct fd_hook_permsgdata *pmd, void * regdata);
 	void  *regdata;
 	struct fd_hook_data_hdl *data_hdl;
@@ -65,13 +65,13 @@
 struct {
 	struct fd_list sentinel;
 	pthread_rwlock_t rwlock;
-} HS_array[HOOK_PEER_LAST+1];
+} HS_array[HOOK_LAST+1];
 
 /* Initialize the array of sentinels for the hooks */
 int fd_hooks_init(void)
 {
 	int i;
-	for (i=0; i <= HOOK_PEER_LAST; i++) {
+	for (i=0; i <= HOOK_LAST; i++) {
 		fd_list_init(&HS_array[i].sentinel, NULL);
 		CHECK_POSIX( pthread_rwlock_init(&HS_array[i].rwlock, NULL) );
 	}
@@ -128,7 +128,7 @@
 	newhdl->regdata = regdata;
 	newhdl->data_hdl = data_hdl;
 	
-	for (i=0; i <= HOOK_PEER_LAST; i++) {
+	for (i=0; i <= HOOK_LAST; i++) {
 		fd_list_init(&newhdl->chain[i], newhdl);
 		if (type_mask & (1<<i)) {
 			CHECK_POSIX( pthread_rwlock_wrlock(&HS_array[i].rwlock) );
@@ -148,7 +148,7 @@
 	TRACE_ENTRY("%p", handler);
 	CHECK_PARAMS( handler );
 	
-	for (i=0; i <= HOOK_PEER_LAST; i++) {
+	for (i=0; i <= HOOK_LAST; i++) {
 		if ( ! FD_IS_LIST_EMPTY(&handler->chain[i])) {
 			CHECK_POSIX( pthread_rwlock_wrlock(&HS_array[i].rwlock) );
 			fd_list_unlink(&handler->chain[i]);
@@ -271,7 +271,7 @@
 	
 	va_start(ap, dummy);
 	while ((next = va_arg(ap, int)) >= 0) {
-		if (next > HOOK_PEER_LAST)
+		if (next > HOOK_LAST)
 			break; /* invalid parameter */
 		ret |= (1<<next);
 	}
@@ -284,7 +284,7 @@
 void   fd_hook_call(enum fd_hook_type type, struct msg * msg, struct fd_peer * peer, void * other, struct fd_msg_pmdl * pmdl)
 {
 	struct fd_list * li;
-	ASSERT(type <= HOOK_PEER_LAST);
+	ASSERT(type <= HOOK_LAST);
 	int call_default = 0;
 	
 	/* lock the list of hooks for this type */
"Welcome to our mercurial repository"