[srvx-commits] CVS: services/src dict-splay.c,1.12,1.13 sockcheck.c,1.93,1.94
Brought to you by:
entrope
From: Entrope <en...@us...> - 2003-12-09 02:48:59
|
Update of /cvsroot/srvx/services/src In directory sc8-pr-cvs1:/tmp/cvs-serv29247/src Modified Files: dict-splay.c sockcheck.c Log Message: improve formatting of code (for profiling/debugging purposes) Index: dict-splay.c =================================================================== RCS file: /cvsroot/srvx/services/src/dict-splay.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** dict-splay.c 7 Jul 2003 16:29:33 -0000 1.12 --- dict-splay.c 9 Dec 2003 02:48:56 -0000 1.13 *************** *** 128,133 **** dict_dispose_node(struct dict_node *node, free_f free_keys, free_f free_data) { ! if (free_keys && node->key) free_keys((void*)node->key); ! if (free_data && node->data) free_data(node->data); free(node); } --- 128,135 ---- dict_dispose_node(struct dict_node *node, free_f free_keys, free_f free_data) { ! if (free_keys && node->key) ! free_keys((void*)node->key); ! if (free_data && node->data) ! free_data(node->data); free(node); } *************** *** 142,146 **** { struct dict_node *new_node; ! if (!key) return; new_node = malloc(sizeof(struct dict_node)); new_node->key = key; --- 144,149 ---- { struct dict_node *new_node; ! if (!key) ! return; new_node = malloc(sizeof(struct dict_node)); new_node->key = key; *************** *** 206,212 **** struct dict_node *new_root; ! if (!dict->root) return 0; dict->root = dict_splay(dict->root, key); ! if (irccasecmp(key, dict->root->key)) return 0; if (!dict->root->l) { --- 209,217 ---- struct dict_node *new_root; ! if (!dict->root) ! return 0; dict->root = dict_splay(dict->root, key); ! if (irccasecmp(key, dict->root->key)) ! return 0; if (!dict->root->l) { *************** *** 241,250 **** int was_found; if (!dict || !dict->root || !key) { ! if (found) *found = 0; return NULL; } dict->root = dict_splay(dict->root, key); was_found = !irccasecmp(key, dict->root->key); ! if (found) *found = was_found; return was_found ? dict->root->data : NULL; } --- 246,257 ---- int was_found; if (!dict || !dict->root || !key) { ! if (found) ! *found = 0; return NULL; } dict->root = dict_splay(dict->root, key); was_found = !irccasecmp(key, dict->root->key); ! if (found) ! *found = was_found; return was_found ? dict->root->data : NULL; } *************** *** 257,261 **** { dict_iterator_t it, next; ! if (!dict) return; for (it=dict_first(dict); it; it=next) { next = iter_next(it); --- 264,269 ---- { dict_iterator_t it, next; ! if (!dict) ! return; for (it=dict_first(dict); it; it=next) { next = iter_next(it); Index: sockcheck.c =================================================================== RCS file: /cvsroot/srvx/services/src/sockcheck.c,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -r1.93 -r1.94 *** sockcheck.c 5 Oct 2003 03:15:29 -0000 1.93 --- sockcheck.c 9 Dec 2003 02:48:56 -0000 1.94 *************** *** 688,692 **** char *ipstr=inet_ntoa(addr); ! if (disable_sockcheck) return; sci = dict_find(checked_ip_dict, ipstr, NULL); if (sci) { --- 688,693 ---- char *ipstr=inet_ntoa(addr); ! if (disable_sockcheck) ! return; sci = dict_find(checked_ip_dict, ipstr, NULL); if (sci) { *************** *** 1060,1063 **** --- 1061,1065 ---- if (disable_sockcheck) { reply("Proxy scanning is $bdisabled$b."); + return 0; } if (argc > 1) { *************** *** 1104,1108 **** sockcheck_read_tests(); timeq_del(0, sockcheck_clean_cache, 0, TIMEQ_IGNORE_WHEN|TIMEQ_IGNORE_DATA); ! if (disable_sockcheck) return; client_list = calloc(sockcheck_conf.max_clients, sizeof(client_list[0])); timeq_add(now+sockcheck_conf.max_cache_age, sockcheck_clean_cache, 0); --- 1106,1111 ---- sockcheck_read_tests(); timeq_del(0, sockcheck_clean_cache, 0, TIMEQ_IGNORE_WHEN|TIMEQ_IGNORE_DATA); ! if (disable_sockcheck) ! return; client_list = calloc(sockcheck_conf.max_clients, sizeof(client_list[0])); timeq_add(now+sockcheck_conf.max_cache_age, sockcheck_clean_cache, 0); |