12 void iterate(struct ptr_list
*list
, void (*callback
)(void *))
16 for (i
= 0; i
< list
->nr
; i
++)
17 callback(list
->list
[i
]);
22 void add_ptr_list(struct ptr_list
**listp
, void *ptr
)
24 struct ptr_list
*list
= *listp
;
27 if (!list
|| (nr
= list
->nr
) >= LIST_NODE_NR
) {
28 struct ptr_list
*newlist
= malloc(sizeof(*newlist
));
30 die("out of memory for symbol/statement lists");
31 memset(newlist
, 0, sizeof(*newlist
));
42 void warn(struct token
*token
, const char * fmt
, ...)
44 static char buffer
[512];
50 vsprintf(buffer
, fmt
, args
);
57 name
= input_streams
[token
->stream
].name
;
62 fprintf(stderr
, "warning: %s:%d:%d: %s\n",
63 name
, line
, pos
, buffer
);
67 void die(const char *fmt
, ...)
70 static char buffer
[512];
73 vsnprintf(buffer
, sizeof(buffer
), fmt
, args
);
76 fprintf(stderr
, "%s\n", buffer
);