mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-23 17:53:37 +08:00
[BZ #5614]
2008-01-15 Ulrich Drepper <drepper@redhat.com> [BZ #5614] * string/bits/string2.h (__strtok_r_1c): Always update *__NEXTP. (__strtok_r): Simplify. * string/tester.c (test_strtok_r): Add test case for futile search with single-character seach string.
This commit is contained in:
parent
7c33ca8bb3
commit
ebca8f730e
@ -1,3 +1,11 @@
|
||||
2008-01-15 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
[BZ #5614]
|
||||
* string/bits/string2.h (__strtok_r_1c): Always update *__NEXTP.
|
||||
(__strtok_r): Simplify.
|
||||
* string/tester.c (test_strtok_r): Add test case for futile search
|
||||
with single-character seach string.
|
||||
|
||||
2008-01-12 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* po/ko.po: Update from translation team.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Machine-independant string function optimizations.
|
||||
Copyright (C) 1997-2003, 2004, 2007 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997-2003, 2004, 2007, 2008 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
@ -1163,10 +1163,9 @@ __strpbrk_c3 (__const char *__s, int __accept1, int __accept2,
|
||||
# ifndef _HAVE_STRING_ARCH_strtok_r
|
||||
# define __strtok_r(s, sep, nextp) \
|
||||
(__extension__ (__builtin_constant_p (sep) && __string2_1bptr_p (sep) \
|
||||
? (((__const char *) (sep))[0] != '\0' \
|
||||
&& ((__const char *) (sep))[1] == '\0' \
|
||||
? __strtok_r_1c (s, ((__const char *) (sep))[0], nextp) \
|
||||
: __strtok_r (s, sep, nextp)) \
|
||||
&& ((__const char *) (sep))[0] != '\0' \
|
||||
&& ((__const char *) (sep))[1] == '\0' \
|
||||
? __strtok_r_1c (s, ((__const char *) (sep))[0], nextp) \
|
||||
: __strtok_r (s, sep, nextp)))
|
||||
# endif
|
||||
|
||||
@ -1189,8 +1188,8 @@ __strtok_r_1c (char *__s, char __sep, char **__nextp)
|
||||
__s[-1] = '\0';
|
||||
break;
|
||||
}
|
||||
*__nextp = __s;
|
||||
}
|
||||
*__nextp = __s;
|
||||
return __result;
|
||||
}
|
||||
# if defined __USE_POSIX || defined __USE_MISC
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Tester for string functions.
|
||||
Copyright (C) 1995-2001, 2003, 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-2001, 2003, 2005, 2008 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -840,9 +840,13 @@ test_strtok_r (void)
|
||||
equal(strtok_r((char *)NULL, ",", &cp), "c", 29);
|
||||
check(strtok_r((char *)NULL, ",", &cp) == NULL, 30);
|
||||
equal(one+6, "gh", 31); /* Stomped past end? */
|
||||
equal(one, "a", 32); /* Stomped old tokens? */
|
||||
equal(one, "a", 32); /* Stomped old tokens? */
|
||||
equal(one+2, "b", 33);
|
||||
equal(one+4, "c", 34);
|
||||
strcpy (one, ":::");
|
||||
cp = NULL;
|
||||
check (strtok_r (one, ":", &cp) == NULL, 35); /* Must store pointer in cp. */
|
||||
check (strtok_r (NULL, ":", &cp) == NULL, 36);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user