about summary refs log tree commit diff
path: root/string/tester.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-01-15 19:11:51 +0000
committerUlrich Drepper <drepper@redhat.com>2008-01-15 19:11:51 +0000
commitebca8f730eb78d3aaa0d245033556e0c9fb0ec35 (patch)
tree54f5894a3862cf25d0bcde542b5145a9309fcd7c /string/tester.c
parent7c33ca8bb39c9885abc06af05d7ef19d16eeef83 (diff)
downloadglibc-ebca8f730eb78d3aaa0d245033556e0c9fb0ec35.tar.gz
glibc-ebca8f730eb78d3aaa0d245033556e0c9fb0ec35.tar.xz
glibc-ebca8f730eb78d3aaa0d245033556e0c9fb0ec35.zip
[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.
Diffstat (limited to 'string/tester.c')
-rw-r--r--string/tester.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/string/tester.c b/string/tester.c
index cccef3ad9d..1c0efe07d4 100644
--- a/string/tester.c
+++ b/string/tester.c
@@ -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