radix: minor debug 'Print' improvements

pull/7018/head
Victor Julien 3 years ago
parent e04d378e58
commit 3ca3c9dfbe

@ -1,4 +1,4 @@
/* Copyright (C) 2007-2010 Open Information Security Foundation /* Copyright (C) 2007-2022 Open Information Security Foundation
* *
* You can copy, redistribute or modify this Program under the terms of * You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free * the GNU General Public License version 2 as published by the Free
@ -1585,27 +1585,23 @@ void SCRadixPrintNodeInfo(SCRadixNode *node, int level, void (*PrintData)(void*
if (node->prefix != NULL) { if (node->prefix != NULL) {
for (i = 0; i * 8 < node->prefix->bitlen; i++) for (i = 0; i * 8 < node->prefix->bitlen; i++)
printf("%s%d", (0 == i ? "" : "."), node->prefix->stream[i]); printf("%s%d", (0 == i ? "" : "."), node->prefix->stream[i]);
printf(")\n"); printf(") user_data %p\n", node->prefix->user_data);
SCRadixUserData *ud = NULL; SCRadixUserData *ud = node->prefix->user_data;
if (PrintData != NULL) { do {
do { for (int x = 0; x <= level; x++)
ud = node->prefix->user_data; printf(" ");
printf(" [%d], ", ud->netmask); printf("[%d] (%p): ", ud->netmask, ud->user);
if (PrintData != NULL) {
PrintData(ud->user); PrintData(ud->user);
ud = ud->next; } else {
} while (ud != NULL); printf("NULL");
} else { }
//ud = node->prefix->user_data; printf("\n");
//while (ud != NULL) { ud = ud->next;
// printf(" [nm %d with data], ", ud->netmask); } while (ud != NULL);
// ud = ud->next;
//}
printf("No print function provided");
}
printf("\n");
} else { } else {
printf("NULL)\n"); printf("inter_node)\n");
} }
return; return;

Loading…
Cancel
Save