[sr-dev] git:sr_3.0: userblacklist(k): gcc 2.95 compile fixes

Andrei Pelinescu-Onciul andrei at iptel.org
Mon Oct 12 18:32:51 CEST 2009


Module: sip-router
Branch: sr_3.0
Commit: 275899b1395c07b5ab83552a24fca06aa3835c85
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=275899b1395c07b5ab83552a24fca06aa3835c85

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Mon Oct 12 18:08:29 2009 +0200

userblacklist(k): gcc 2.95 compile fixes

- variables must be declared at the beginning of a block

---

 modules_k/userblacklist/db.c            |    8 ++++----
 modules_k/userblacklist/userblacklist.c |   10 +++++++---
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/modules_k/userblacklist/db.c b/modules_k/userblacklist/db.c
index fc8c915..dd7c986 100644
--- a/modules_k/userblacklist/db.c
+++ b/modules_k/userblacklist/db.c
@@ -46,6 +46,10 @@ int db_build_userbl_tree(const str *username, const str *domain, const str *tabl
 	db_key_t key[2] = { &userblacklist_username_col, &userblacklist_domain_col };
 
 	db_val_t val[2];
+	db1_res_t *res;
+	int i;
+	int n = 0;
+	void *nodeflags;
 	VAL_TYPE(val) = VAL_TYPE(val + 1) = DB1_STR;
 	VAL_NULL(val) = VAL_NULL(val + 1) = 0;
 	VAL_STR(val).s = username->s;
@@ -53,10 +57,6 @@ int db_build_userbl_tree(const str *username, const str *domain, const str *tabl
 	VAL_STR(val + 1).s = domain->s;
 	VAL_STR(val + 1).len = domain->len;
 
-	db1_res_t *res;
-	int i;
-	int n = 0;
-	void *nodeflags;
 	
 	if (userblacklist_dbf.use_table(userblacklist_dbh, table) < 0) {
 		LM_ERR("cannot use table '%.*s'.\n", table->len, table->s);
diff --git a/modules_k/userblacklist/userblacklist.c b/modules_k/userblacklist/userblacklist.c
index e893571..83a4f6e 100644
--- a/modules_k/userblacklist/userblacklist.c
+++ b/modules_k/userblacklist/userblacklist.c
@@ -380,6 +380,8 @@ static int check_blacklist_fixup(void **arg, int arg_no)
 {
 	char *table = (char *)(*arg);
 	struct dtrie_node_t *node = NULL;
+	struct check_blacklist_fs_t *new_arg;
+	
 	if (arg_no != 1) {
 		LM_ERR("wrong number of parameters\n");
 		return -1;
@@ -402,7 +404,7 @@ static int check_blacklist_fixup(void **arg, int arg_no)
 		return -1;
 	}
 
-	struct check_blacklist_fs_t *new_arg = (struct check_blacklist_fs_t*)pkg_malloc(sizeof(struct check_blacklist_fs_t));
+	new_arg = pkg_malloc(sizeof(struct check_blacklist_fs_t));
 	if (!new_arg) {
 		PKG_MEM_ERROR;
 		return -1;
@@ -475,15 +477,17 @@ static int reload_sources(void)
 {
 	int result = 0;
 	str tmp;
+	struct source_t *src;
+	int n;
 
 	/* critical section start: avoids dirty reads when updating d-tree */
 	lock_get(lock);
 
-	struct source_t *src = sources->head;
+	src = sources->head;
 	while (src) {
 		tmp.s = src->table;
 		tmp.len = strlen(src->table);
-		int n = db_reload_source(&tmp, src->dtrie_root);
+		n = db_reload_source(&tmp, src->dtrie_root);
 		if (n < 0) {
 			LM_ERR("cannot reload source from '%.*s'\n", tmp.len, tmp.s);
 			result = -1;




More information about the sr-dev mailing list