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 v2 12/12] posix: Remove VLA usage for internal fnmatch implementation



On 05/02/2018 11:40, Andreas Schwab wrote:
> On Feb 05 2018, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
> 
>> diff --git a/posix/fnmatch_loop.c b/posix/fnmatch_loop.c
>> index eadb343..831e5ba 100644
>> --- a/posix/fnmatch_loop.c
>> +++ b/posix/fnmatch_loop.c
>> @@ -493,26 +493,20 @@ FCT (const CHAR *pattern, const CHAR *string, const CHAR *string_end,
>>  			  {
>>  			    int32_t table_size;
>>  			    const int32_t *symb_table;
>> -# if WIDE_CHAR_VERSION
>> -			    char str[c1];
>> -			    unsigned int strcnt;
>> -# else
>> -#  define str (startp + 1)
>> -# endif
>> +			    struct char_array str;
>> +			    char_array_init_empty (&str);
>>  			    const unsigned char *extra;
>>  			    int32_t idx;
>>  			    int32_t elem;
>>  			    int32_t second;
>>  			    int32_t hash;
>>  
>> -# if WIDE_CHAR_VERSION
>>  			    /* We have to convert the name to a single-byte
>>  			       string.  This is possible since the names
>>  			       consist of ASCII characters and the internal
>>  			       representation is UCS4.  */
>> -			    for (strcnt = 0; strcnt < c1; ++strcnt)
>> -			      str[strcnt] = startp[1 + strcnt];
>> -#endif
>> +			    for (size_t strcnt = 0; strcnt < c1; ++strcnt)
>> +			      char_array_append_char (&str, startp[1 + strcnt]);
>>  
>>  			    table_size =
>>  			      _NL_CURRENT_WORD (LC_COLLATE,
> 
> That needs to be removed altogether, see
> <http://sourceware.org/ml/libc-alpha/2017-04/msg00068.html>.

Nice, I missed your patch.  It seems to apply clean, I will review on the original
thread.


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