This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: 2.29 freeze update: Last fortnight
- From: Rafal Luzynski <digitalfreak at lingonborough dot com>
- To: TAMUKI Shoichi <tamuki at linet dot gr dot jp>, libc-alpha at sourceware dot org
- Cc: Siddhesh Poyarekar <siddhesh at gotplt dot org>, Carlos O'Donell <carlos at redhat dot com>, Joseph Myers <joseph at codesourcery dot com>
- Date: Thu, 17 Jan 2019 21:32:23 +0100 (CET)
- Subject: Re: 2.29 freeze update: Last fortnight
- References: <2111495405.10604.1547571179024@poczta.nazwa.pl> <201901170629.AA04184@tamuki.linet.gr.jp>
17.01.2019 07:29 TAMUKI Shoichi <tamuki@linet.gr.jp> wrote:
>
> Hello Rafal,
>
> From: Rafal Luzynski <digitalfreak@lingonborough.com>
> Subject: Re: 2.29 freeze update: Last fortnight
> Date: Tue, 15 Jan 2019 17:52:58 +0100 (CET)
>
> > 2. I still don't understand why the newly added argument of
> > __strftime_internal yr_spec is of the type "int *" rather than just
> > "int". Maybe it is correct and the reason is that I have not
> > analyzed it carefully enough. I'm sorry, I am unable to analyze
> > it more carefully this week.
>
> The yr_spec variable is initially definded in my_strftime function,
> and __strftime_internal function is called there.
>
> The __strftime_internal function is a recursive structure that calls
> itself in subformat: label within the function. The subformat: label
> is used in the processing of %Ex, %D, %F, %R, %r, %EX, %T, and %EY.
>
> The value of the yr_spec variable is updated while walking around
> these functions, and it needs to be treated as if it were a global
> variable. If it is called by value, the value is not retained.
> Therefore, it is called by address.
I understand how it works but I don't understand why you need this.
Passing a variable by the pointer suggests that it is an input/output
argument (or maybe even only output). Do you use the value of yr_spec
as an additional result of __strftime_internal? I can't see any
occurrence of yr_spec being read by the caller.
In other words: what would happen if yr_spec was just int?
> In additon, since tzset_called variable used in %Z and %z processing
> also needs to be treated as if it were a global variable in the same
> way as above, call by address is used.
I can see that tzset_called ensures that tzset() is called only once:
if it was called by the first recursive call of __strftime_internal
then it is not called by the second call. I can't see any other
similar one-time operation ensured by yr_spec.
Regards,
Rafal