117
struct span *make_span(struct info *info) {
118
struct span *span = NULL;
119
if (ALLOC(span) < 0) {
122
/* UINT_MAX means span is not initialized yet */
123
span->span_start = UINT_MAX;
124
span->filename = ref(info->filename);
128
void free_span(struct span *span) {
131
unref(span->filename, string);
135
void print_span(struct span *span) {
138
printf("%s label=(%i:%i) value=(%i:%i) span=(%i,%i)\n",
140
span->label_start, span->label_end,
141
span->value_start, span->value_end,
142
span->span_start, span->span_end);
145
void update_span(struct span *node_info, int x, int y) {
146
if (node_info == NULL)
148
if (node_info->span_start == UINT_MAX) {
149
node_info->span_start = x;
150
node_info->span_end = y;
152
if (node_info->span_start > x)
153
node_info->span_start = x;
154
if (node_info->span_end < y)
155
node_info->span_end = y;
117
160
* Local variables:
118
161
* indent-tabs-mode: nil