X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/1b95e2a0c983bf148c346085dd5a1b434e3298cf..349ccb810b6e89b1830dbbe70c9e805a2773fcbe:/sbr/utils.c diff --git a/sbr/utils.c b/sbr/utils.c index 262e5767..7f0760a0 100644 --- a/sbr/utils.c +++ b/sbr/utils.c @@ -9,9 +9,7 @@ #include #include -#include #include -#include /* * We allocate space for messages (msgs array) @@ -226,6 +224,22 @@ app_msgarg(struct msgs_array *msgs, char *cp) msgs->msgs[msgs->size++] = cp; } +/* + * Append a message number to an array of them, resizing it if necessary. + * Like app_msgarg, but with a vector-of-ints instead. + */ + +void +app_msgnum(struct msgnum_array *msgs, int msgnum) +{ + if (msgs->size >= msgs->max) { + msgs->max += MAXMSGS; + msgs->msgnums = mh_xrealloc(msgs->msgnums, + msgs->max * sizeof(*msgs->msgnums)); + } + msgs->msgnums[msgs->size++] = msgnum; +} + /* Open a form or components file */ int open_form(char **form, char *def)