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] Fix handling of collating elements in fnmatch (bug 17396, bug 16976)


* Andreas Schwab:

> This fixes the same bug in fnmatch that was fixed by commit 7e2f0d2d77 for
> regexp matching.  As a side effect it also removes the use of an unbound
> VLA.
>
> 	[BZ #16976]
> 	[BZ #17396]
> 	* posix/fnmatch_loop.c (internal_fnmatch, internal_fnwmatch): When
> 	looking up collating elements match against (wide) character
> 	sequence instead of name.  Correct alignment adjustment.
> 	* posix/fnmatch.c: Don't include "../locale/elem-hash.h".
> 	* posix/Makefile (tests): Add tst-fnmatch4 and tst-fnmatch5.
> 	(LOCALES): Add cs_CZ.ISO-8859-2.
> 	* posix/tst-fnmatch4.c: New file.
> 	* posix/tst-fnmatch5.c: New file.

> +				      /* Compare the wide char sequence.  */
> +				      && memcmp (startp + 1, &wextra[1],
> +						 c1 * sizeof (UCHAR)) == 0)

Could this use wmemcmp?


> +				      if (/* Compare the length of the
> +					     sequence.  */
> +					  c1 == wextra[0]
> +					  /* Compare the wide char sequence.  */
> +					  && memcmp (startp + 1, &wextra[1],
> +						     c1 * sizeof (int32_t)) == 0)

Likewise: Could this use wmemcmp?

Rest of the patch looks fine to me, as far as I can judge such matters.

Please note: The copyright year on the new files needs to be adjusted.

Thanks,
Florian


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