Hi Assaf,

> This function enables syntax-check of the format string.

First question: Should this syntax-check be integrated into the
nstrftime() and fprintftime() functions? These functions are gnulib
inventions, therefore they could be extended to return
  - an error indicator (maybe EINVAL?),
  - a detailed error message, if you like,
  - a pointer to the wrong directive in the format string, if you like.
Or is it better to have a function that does only the syntax check,
and document that nstrftime() and fprintftime() should only be called
after the syntax check has been done?
(I have no preference. Just asking.)

> I'd like to suggest the following new module: fprintftime-check.

For a module that does only the syntax check, I would suggest a
different name:
  - The prefix 'fprint' indicates output to a 'FILE *'.
  - The prefix 'str' indicates output to a 'char *' buffer.
Why not call it 'ftime-check' or 'check-ftime'?

> It uses the same infrastructure as fprintftime
> (i.e. #include "nstrtime,c")

That's a good idea, otherwise the syntax check and the actual use of
the format string might too easily get out-of-sync.

> This patch is only a rough draft

tzalloc() may fail and return NULL. (And why would parsing the format
string be dependent on a particular time zone at all?)


Reply via email to