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] gconv: Replace norm_add_slashes with __gconv_norm_add_slashes



On 19/06/2017 19:17, Florian Weimer wrote:
> On 06/19/2017 11:38 PM, Adhemerval Zanella wrote:
> 
>> I think this is a good candidate for char_array usage [1]:
>>
>> #define CHAR_ARRAY_INITIAL_SIZE 0
>> #include <malloc/char_array-skeleton.c>
>> […]
> 
> Hmm, I'll review your latest char_array patch, then.  But if we have
> multiple users, we should think about out-lining more of the code.

Yes, I will resend a new version with some out-lining code.

> 
> I believe Arjun may also need a variant of this function
> (norm_add_slashes) for his iconv -c fix.
> 
>>> +		      if (charset == NULL || outcharset == NULL)
>>> +			{
>>> +			  free ((char *) encoding);
>>
>> No need to cast on free.
> 
> encoding is a const char *.

Indeed... I think we can live with it for now, but this is really a bad idiom
and we should cleanup this later.

> 
>> In fact these seems another place where a char_array could find some use
>> to avoid all the boilerplate of managing buffers size to appendages and
>> buffer management (and we could get some speed up by using the stack as
>> well).
> 
> But we can realistically make such far-reaching changes only after
> eliminating the conditional compilation, and that's not something I want
> to do in this patch.

Fair enough, I also think we should focus on alloca elimination as well.


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