[asterisk-commits] murf: branch murf/bug11210 r103706 - /team/murf/bug11210/utils/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 14 18:07:07 CST 2008


Author: murf
Date: Thu Feb 14 18:07:07 2008
New Revision: 103706

URL: http://svn.digium.com/view/asterisk?view=rev&rev=103706
Log:
Fixed up refcounter.c, and added it to the makefile.

Modified:
    team/murf/bug11210/utils/Makefile
    team/murf/bug11210/utils/refcounter.c

Modified: team/murf/bug11210/utils/Makefile
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/utils/Makefile?view=diff&rev=103706&r1=103705&r2=103706
==============================================================================
--- team/murf/bug11210/utils/Makefile (original)
+++ team/murf/bug11210/utils/Makefile Thu Feb 14 18:07:07 2008
@@ -17,7 +17,7 @@
 .PHONY: clean all uninstall
 
 # to get check_expr, add it to the ALL_UTILS list
-ALL_UTILS:=astman smsq stereorize streamplayer aelparse muted check_expr conf2ael hashtest2 hashtest astcanary
+ALL_UTILS:=astman smsq stereorize streamplayer aelparse muted check_expr conf2ael hashtest2 hashtest astcanary refcounter
 UTILS:=$(ALL_UTILS)
 
 LIBS += $(BKTR_LIB)	# astobj2 with devmode uses backtrace
@@ -76,7 +76,7 @@
 	rm -f *.s *.i
 	rm -f md5.c strcompat.c ast_expr2.c ast_expr2f.c pbx_ael.c pval.c hashtab.c
 	rm -f aelparse.c aelbison.c conf2ael
-	rm -f utils.c threadstorage.c sha1.c astobj2.c hashtest2 hashtest
+	rm -f utils.c threadstorage.c sha1.c astobj2.c hashtest2 hashtest refcounter
 
 md5.c: $(ASTTOPDIR)/main/md5.c
 	@cp $< $@
@@ -153,6 +153,10 @@
 
 hashtest.o: ASTCFLAGS+=-O0
 
+refcounter: refcounter.o md5.o hashtab.o utils.o sha1.o strcompat.o threadstorage.o clicompat.o
+
+refcounter.o: ASTCFLAGS+=-O0
+
 extconf.o: extconf.c
 
 conf2ael: conf2ael.o ast_expr2f.o ast_expr2.o aelbison.o aelparse.o pbx_ael.o pval.o extconf.o strcompat.o

Modified: team/murf/bug11210/utils/refcounter.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/utils/refcounter.c?view=diff&rev=103706&r1=103705&r2=103706
==============================================================================
--- team/murf/bug11210/utils/refcounter.c (original)
+++ team/murf/bug11210/utils/refcounter.c Thu Feb 14 18:07:07 2008
@@ -110,23 +110,23 @@
 
 
 
-main(int argc,char **argv)
+int main(int argc,char **argv)
 {
 	char linebuffer[300];
 	FILE *ifile = fopen("/tmp/refs", "r");
 	char *t;
 	unsigned int un;
-	int curcount;
 	struct rc_obj *curr_obj, *count1_obj;
 	struct rc_obj lookup;
 	struct ast_hashtab_iter *it;
+	struct ast_hashtab *objhash;
 	
 	if (!ifile) {
 		printf("Sorry, Cannot open /tmp/refs!\n");
 		exit(10);
 	}
 	
-	struct ast_hashtab *objhash = ast_hashtab_create(9000, hashtab_compare_rc, ast_hashtab_resize_java, ast_hashtab_newsize_java, hashtab_hash_rc, 1);
+	objhash = ast_hashtab_create(9000, hashtab_compare_rc, ast_hashtab_resize_java, ast_hashtab_newsize_java, hashtab_hash_rc, 1);
 	
 	while (fgets(linebuffer, sizeof(linebuffer), ifile)) {
 		/* collect data about the entry */
@@ -156,7 +156,7 @@
 		} else {
 			/* NO obj at ALL? -- better make one! */
 			if (*(t+1) != '=') {
-				printf("BAD: object %x appears without previous allocation marker!\n");
+				printf("BAD: object %x appears without previous allocation marker!\n", count1_obj->addr);
 			}
 			curr_obj = count1_obj = alloc_obj(un, 1);
 			/* put it in the hashtable */
@@ -176,7 +176,7 @@
 	
 	/* traverse the objects and check for problems */
 	it = ast_hashtab_start_traversal(objhash);
-	while (curr_obj = ast_hashtab_next(it)) {
+	while ((curr_obj = ast_hashtab_next(it))) {
 		if (curr_obj->total_refcount != 0 || curr_obj->destroy_count != 1) {
 			struct rc_hist *h;
 			if (curr_obj->total_refcount != 0)
@@ -193,6 +193,7 @@
 		}
 	}
 	ast_hashtab_end_traversal(it);
+	return 0;
 }
 
 




More information about the asterisk-commits mailing list