Browse code

userblacklist(k): gcc 2.95 compile fixes

- variables must be declared at the beginning of a block

Andrei Pelinescu-Onciul authored on 12/10/2009 16:08:29
Showing 2 changed files
... ...
@@ -46,6 +46,10 @@ int db_build_userbl_tree(const str *username, const str *domain, const str *tabl
46 46
 	db_key_t key[2] = { &userblacklist_username_col, &userblacklist_domain_col };
47 47
 
48 48
 	db_val_t val[2];
49
+	db1_res_t *res;
50
+	int i;
51
+	int n = 0;
52
+	void *nodeflags;
49 53
 	VAL_TYPE(val) = VAL_TYPE(val + 1) = DB1_STR;
50 54
 	VAL_NULL(val) = VAL_NULL(val + 1) = 0;
51 55
 	VAL_STR(val).s = username->s;
... ...
@@ -53,10 +57,6 @@ int db_build_userbl_tree(const str *username, const str *domain, const str *tabl
53 57
 	VAL_STR(val + 1).s = domain->s;
54 58
 	VAL_STR(val + 1).len = domain->len;
55 59
 
56
-	db1_res_t *res;
57
-	int i;
58
-	int n = 0;
59
-	void *nodeflags;
60 60
 	
61 61
 	if (userblacklist_dbf.use_table(userblacklist_dbh, table) < 0) {
62 62
 		LM_ERR("cannot use table '%.*s'.\n", table->len, table->s);
... ...
@@ -380,6 +380,8 @@ static int check_blacklist_fixup(void **arg, int arg_no)
380 380
 {
381 381
 	char *table = (char *)(*arg);
382 382
 	struct dtrie_node_t *node = NULL;
383
+	struct check_blacklist_fs_t *new_arg;
384
+	
383 385
 	if (arg_no != 1) {
384 386
 		LM_ERR("wrong number of parameters\n");
385 387
 		return -1;
... ...
@@ -402,7 +404,7 @@ static int check_blacklist_fixup(void **arg, int arg_no)
402 404
 		return -1;
403 405
 	}
404 406
 
405
-	struct check_blacklist_fs_t *new_arg = (struct check_blacklist_fs_t*)pkg_malloc(sizeof(struct check_blacklist_fs_t));
407
+	new_arg = pkg_malloc(sizeof(struct check_blacklist_fs_t));
406 408
 	if (!new_arg) {
407 409
 		PKG_MEM_ERROR;
408 410
 		return -1;
... ...
@@ -475,15 +477,17 @@ static int reload_sources(void)
475 477
 {
476 478
 	int result = 0;
477 479
 	str tmp;
480
+	struct source_t *src;
481
+	int n;
478 482
 
479 483
 	/* critical section start: avoids dirty reads when updating d-tree */
480 484
 	lock_get(lock);
481 485
 
482
-	struct source_t *src = sources->head;
486
+	src = sources->head;
483 487
 	while (src) {
484 488
 		tmp.s = src->table;
485 489
 		tmp.len = strlen(src->table);
486
-		int n = db_reload_source(&tmp, src->dtrie_root);
490
+		n = db_reload_source(&tmp, src->dtrie_root);
487 491
 		if (n < 0) {
488 492
 			LM_ERR("cannot reload source from '%.*s'\n", tmp.len, tmp.s);
489 493
 			result = -1;