This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/4] time/tst-strftime2.c: Make the file easier to maintain


Carlos,

Thank you for your reviews.  One question below:

1.04.2019 22:34 Carlos O'Donell <codonell@redhat.com> wrote:
> 
> On 3/31/19 11:58 PM, TAMUKI Shoichi wrote:
> [...]
> >   #include <locale.h>
> >   #include <time.h>
> >   #include <stdio.h>
> >   #include <string.h>
> >   
> > -static const char *locales[] = { "ja_JP.UTF-8", "lo_LA.UTF-8",
> > "th_TH.UTF-8" };
> > +static const char *locales[] =
> > +{
> > +  "ja_JP.UTF-8", "lo_LA.UTF-8", "th_TH.UTF-8"
> > +};
> 
> Add enum and use below, this prevents constant and comment
> getting out of sync.
> 
> /* Must match locale index into locales array.  */
> typedef enum
>    {
>      ja_JP, lo_LA, th_TH
>    } test_locale;

That's a great idea.  What about an idea to define an enum of
months like DJ did in one of his recent patches?

> > [...]
> > @@ -107,8 +134,8 @@ do_test (void)
> >   	  for (k = 0; k < array_length (dates); k++)
> >   	    {
> >   	      ttm.tm_mday = dates[k].d;
> > -	      ttm.tm_mon  = dates[k].m;
> > -	      ttm.tm_year = dates[k].y;
> > +	      ttm.tm_mon  = dates[k].m - 1;
> > +	      ttm.tm_year = dates[k].y - 1900;
> 
> OK. I like the use of proper years and 1-index months for test data.

That would make months zero-based and convenient to use at the same
time.

I'm OK with the rest of your comments.

Regards,

Rafal


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]