61 goto truncate;
62 pos += snprintf(buf + pos, sizeof(buf) - pos, "%s",
63 show_state(tmp->state));
64 if (pos > sizeof(buf))
65 goto truncate;
66 } END_FOR_EACH_PTR(tmp);
67 snprintf(buf + pos, sizeof(buf) - pos, ")");
68
69 return buf;
70
71 truncate:
72 for (i = 0; i < 3; i++)
73 buf[sizeof(buf) - 2 - i] = '.';
74 return buf;
75 }
76
77 void __print_stree(struct stree *stree)
78 {
79 struct sm_state *sm;
80
81 printf("dumping stree at %d [%ld states]\n", get_lineno(), stree_count(stree));
82 FOR_EACH_SM(stree, sm) {
83 printf("%s\n", show_sm(sm));
84 } END_FOR_EACH_SM(sm);
85 printf("---\n");
86 }
87
88 /* NULL states go at the end to simplify merge_slist */
89 int cmp_tracker(const struct sm_state *a, const struct sm_state *b)
90 {
91 int ret;
92
93 if (a == b)
94 return 0;
95 if (!b)
96 return -1;
97 if (!a)
98 return 1;
99
100 if (a->owner < b->owner)
101 return -1;
102 if (a->owner > b->owner)
103 return 1;
104
105 ret = strcmp(a->name, b->name);
|
61 goto truncate;
62 pos += snprintf(buf + pos, sizeof(buf) - pos, "%s",
63 show_state(tmp->state));
64 if (pos > sizeof(buf))
65 goto truncate;
66 } END_FOR_EACH_PTR(tmp);
67 snprintf(buf + pos, sizeof(buf) - pos, ")");
68
69 return buf;
70
71 truncate:
72 for (i = 0; i < 3; i++)
73 buf[sizeof(buf) - 2 - i] = '.';
74 return buf;
75 }
76
77 void __print_stree(struct stree *stree)
78 {
79 struct sm_state *sm;
80
81 option_debug++;
82 sm_msg("dumping stree [%ld states]", stree_count(stree));
83 FOR_EACH_SM(stree, sm) {
84 sm_printf("%s\n", show_sm(sm));
85 } END_FOR_EACH_SM(sm);
86 sm_printf("---\n");
87 option_debug--;
88 }
89
90 /* NULL states go at the end to simplify merge_slist */
91 int cmp_tracker(const struct sm_state *a, const struct sm_state *b)
92 {
93 int ret;
94
95 if (a == b)
96 return 0;
97 if (!b)
98 return -1;
99 if (!a)
100 return 1;
101
102 if (a->owner < b->owner)
103 return -1;
104 if (a->owner > b->owner)
105 return 1;
106
107 ret = strcmp(a->name, b->name);
|