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: 2.29 freeze update: Last fortnight


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


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