aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/crunch.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/crunch.c b/src/crunch.c
index 66c55fa..480fb81 100644
--- a/src/crunch.c
+++ b/src/crunch.c
@@ -73,7 +73,7 @@ void indent(int level) {
fputs(" ", stdout);
}
-int maxkidcount = 0, maxlevel = 0, totalkidcount = 0;
+int maxkidcount = 0, maxlevel = 0, totalkidcount = 0, nodeswithkids = 0;
void dump_kids(token_t *t, int level) {
token_t *kid;
int kidcount =0;
@@ -93,6 +93,7 @@ void dump_kids(token_t *t, int level) {
indent(level - 1);
printf("#%d has %d kids\n", t->number, kidcount);
if(kidcount > maxkidcount) maxkidcount = kidcount;
+ nodeswithkids++;
} else {
indent(level);
fputs("(no kids)\n", stdout);
@@ -102,7 +103,7 @@ void dump_kids(token_t *t, int level) {
void dump_tokens(void) {
int i;
- maxkidcount = maxlevel = totalkidcount = 0;
+ maxkidcount = maxlevel = totalkidcount = nodeswithkids = 0;
for(i = 0; i < 256; i++) {
if(root_tokens[i].kids) {
@@ -112,7 +113,7 @@ void dump_tokens(void) {
}
printf("maxkidcount %d, maxlevel = %d, totalkidcount = %d\n", maxkidcount, maxlevel, totalkidcount);
- printf("avgkidcount: %.2f\n", ((float)totalkidcount) / (float)(curr_token - INIT_TOKEN));
+ printf("avgkidcount: %.2f\n", ((float)totalkidcount) / (float)(nodeswithkids));
}
void inc_output_len(void) {