On Thu, May 10, 2018 at 10:19 AM Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> wrote: > This array will be used by some other function than parse_msg_id() in > the following commit. Factor out this prep code so it could be called > from that one. > Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> > --- > diff --git a/fsck.c b/fsck.c > @@ -84,26 +84,32 @@ static struct { > -static int parse_msg_id(const char *text) > +static void prepare_msg_ids(void) > { > - if (!msg_id_info[0].downcased) { > - /* convert id_string to lower case, without underscores. */ > - for (i = 0; i < FSCK_MSG_MAX; i++) { > - [...] > - } > + /* convert id_string to lower case, without underscores. */ > + for (i = 0; i < FSCK_MSG_MAX; i++) { > + [...] > } > +} > + > +static int parse_msg_id(const char *text) > +{ > + if (!msg_id_info[0].downcased) > + prepare_msg_ids(); If you move the "if (!msg_id_info...)" conditional into the new parpare_msg_ids() function, then it becomes self-contained; it takes care of avoiding double-initialization so callers don't have to worry or know about it. (Doing so would also make the diff less noisy.) Not at all worth a re-roll.