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] Improve the width of alternate representation for year in strftime [BZ #23758]


* TAMUKI Shoichi:

>> It looks like that there are two changes (plus some formatting cleanups)
>> in this patch: the change in padding:
>> 
>> > -		  DO_NUMBER (1, (era->offset
>> > +		  DO_NUMBER (2, (era->offset
>> >  				 + delta * era->absolute_direction));
>> 
>> and adding a way to override the padding, when %EY is exanded using
>> locale data, rewriting the %Ey contained in the format string.
>
> Yes, that's right.
>
>> I think the second part should be handled differently, by not rewriting
>> the format string, and rather adding strftime arguments (possibly in a
>> struct) to set the default padding.
>> 
>> This should also avoid the need for new memory allocations.
>
> Certainly.  I also want to avoid dynamic memory allocation as much as
> possible.  To add strftime arguments, which is not the prepared format
> string (era_format in locale data) but the modified string (rewriting
> the %Ey), anoher allocated separate memory is required.

Sorry, I don't understand.  I think all we need is a way to change the
default padding, so that the %Ey (unchanged) is interpreted as if
decorated with the appropriate flag.  I think this would avoid the need
to do any dynamically-sized allocations.

> An alternative plan will be to allocate memory beforehand statically.
> In that case, we have to decide the size to be assumed.

That's not possible because users can define their own locales if they
want.

Thanks,
Florian


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