Skip to content

Commit

Permalink
reduce output of cclass mbuf contents in print_indent_tree()
Browse files Browse the repository at this point in the history
  • Loading branch information
kkos committed Apr 24, 2020
1 parent 13c3965 commit f60915e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/regcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -7737,14 +7737,18 @@ print_indent_tree(FILE* f, Node* node, int indent)
break;

case NODE_CCLASS:
#define CCLASS_MBUF_MAX_OUTPUT_NUM 10

fprintf(f, "<cclass:%p>", node);
if (IS_NCCLASS_NOT(CCLASS_(node))) fputs(" not", f);
if (CCLASS_(node)->mbuf) {
BBuf* bbuf = CCLASS_(node)->mbuf;
for (i = 0; i < bbuf->used; i++) {
fprintf(f, " mbuf(%u) ", bbuf->used);
for (i = 0; i < bbuf->used && i < CCLASS_MBUF_MAX_OUTPUT_NUM; i++) {
if (i > 0) fprintf(f, ",");
fprintf(f, "%0x", bbuf->p[i]);
}
if (i < bbuf->used) fprintf(f, "...");
}
break;

Expand Down

0 comments on commit f60915e

Please sign in to comment.