Pádraig Brady wrote: ... > +/* In the unlikely event that the abmon[] storage is not big enough > + an error message will be displayed, and we revert to using > + unmodified abbreviated month names from the locale database. */ > +static char abmon[12][MAX_MON_WIDTH * 2 * MB_LEN_MAX + 1]; > +/* minimum width needed to align %b, 0 => don't use precomputed values. */ > +static int required_mon_width; > + > +static void > +abmon_init (void) > +{ > +#ifdef HAVE_NL_LANGINFO > + required_mon_width = MAX_MON_WIDTH; > + int curr_max_width; > + do > + { > + curr_max_width = required_mon_width; > + required_mon_width = 0; > + for (int i = 0; i < 12; i++) > + { > + int width = curr_max_width; > + > + int req = mbsalign (nl_langinfo (ABMON_1 + i), > + abmon[i], sizeof (abmon[i]), > + &width, MBS_ALIGN_LEFT); > + > + if (req >= sizeof(abmon[i])) > + { > + error (0, 0, _("overflow initializing month strings")); > + required_mon_width = 0; /* ignore precomputed strings. */ > + return;
It's usually best to avoid "void" functions. In this case, to be more library friendly, it should avoid calling error, and simply return an indication of failure. _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils