1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00
2001-02-23  Andreas Jaeger  <aj@suse.de>

	* string/tester.c (test_strtok_r): Add testcase.
	(test_strtok_r): Always initialize cp for proper checking.

	* sysdeps/generic/strtok.c (strtok): Handle case of first strtok
	returning NULL correctly.
	Patch by Fumitoshi UKAI <ukai@debian.or.jp>.
	* sysdeps/generic/strtok_r.c (__strtok_r): Likewise.

2001-02-23  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/unix/sysv/aix/bits/types.h: Define __need_NULL before
	including <stddef.h>.
	* sysdeps/unix/sysv/aix/write.c: Define alias __libc_write.
	* include/libc-symbols.h (weak_alias): Don't use .weak if
	HAVE_ASM_GLOBAL_DOT_NAME is defined.
	Patches by Michael Keezer <mkeezer@redhat.com>.

	* sysdeps/generic/ftime.c: Don't include <sys/time.h> at all.
	Patch by Michael Keezer <mkeezer@redhat.com>.

	* sysdeps/unix/sysv/aix/Dist: Remove restf.S and savef.S.
	* sysdeps/unix/sysv/aix/Makefile [$(subdir) == misc]
	(sysdep_routines): Remove restf.S and savef.S.
	* sysdeps/unix/sysv/aix/restf.S. Removed.
	* sysdeps/unix/sysv/aix/savef.S. Removed.
	* sysdeps/powerpc/fprrest.S: Use C_TEXT to define label.  Also define
	alternative names used on some platforms.
	* sysdeps/powerpc/fprsave.S: Likewise.
	* sysdeps/powerpc/gprrest0.S: Likewise.
	* sysdeps/powerpc/gprrest1.S: Likewise.
	* sysdeps/powerpc/gprsave0.S: Likewise.
	* sysdeps/powerpc/gprsave1.S: Likewise.
	Patch by Michael Keezer <mkeezer@redhat.com>.
This commit is contained in:
Ulrich Drepper
2001-02-23 20:29:25 +00:00
parent 578af33815
commit d436a9f710
12 changed files with 77 additions and 141 deletions

View File

@ -1,3 +1,39 @@
2001-02-23 Andreas Jaeger <aj@suse.de>
* string/tester.c (test_strtok_r): Add testcase.
(test_strtok_r): Always initialize cp for proper checking.
* sysdeps/generic/strtok.c (strtok): Handle case of first strtok
returning NULL correctly.
Patch by Fumitoshi UKAI <ukai@debian.or.jp>.
* sysdeps/generic/strtok_r.c (__strtok_r): Likewise.
2001-02-23 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/aix/bits/types.h: Define __need_NULL before
including <stddef.h>.
* sysdeps/unix/sysv/aix/write.c: Define alias __libc_write.
* include/libc-symbols.h (weak_alias): Don't use .weak if
HAVE_ASM_GLOBAL_DOT_NAME is defined.
Patches by Michael Keezer <mkeezer@redhat.com>.
* sysdeps/generic/ftime.c: Don't include <sys/time.h> at all.
Patch by Michael Keezer <mkeezer@redhat.com>.
* sysdeps/unix/sysv/aix/Dist: Remove restf.S and savef.S.
* sysdeps/unix/sysv/aix/Makefile [$(subdir) == misc]
(sysdep_routines): Remove restf.S and savef.S.
* sysdeps/unix/sysv/aix/restf.S. Removed.
* sysdeps/unix/sysv/aix/savef.S. Removed.
* sysdeps/powerpc/fprrest.S: Use C_TEXT to define label. Also define
alternative names used on some platforms.
* sysdeps/powerpc/fprsave.S: Likewise.
* sysdeps/powerpc/gprrest0.S: Likewise.
* sysdeps/powerpc/gprrest1.S: Likewise.
* sysdeps/powerpc/gprsave0.S: Likewise.
* sysdeps/powerpc/gprsave1.S: Likewise.
Patch by Michael Keezer <mkeezer@redhat.com>.
2001-02-22 Ulrich Drepper <drepper@redhat.com> 2001-02-22 Ulrich Drepper <drepper@redhat.com>
* sysdeps/i386/elf/start.S (_fp_hw): Actually define label. * sysdeps/i386/elf/start.S (_fp_hw): Actually define label.

View File

@ -1,6 +1,6 @@
/* Support macros for making weak and strong aliases for symbols, /* Support macros for making weak and strong aliases for symbols,
and for using symbol sets and linker warnings with GNU ld. and for using symbol sets and linker warnings with GNU ld.
Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc. Copyright (C) 1995,1996,1997,1998,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -154,7 +154,7 @@
# define weak_alias(original, alias) \ # define weak_alias(original, alias) \
.weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \ .weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \
C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \ C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original) ASM_LINE_SEP \
.weak C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \ ASM_GLOBAL_DIRECTIVE C_SYMBOL_DOT_NAME (alias) ASM_LINE_SEP \
C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original) C_SYMBOL_DOT_NAME (alias) = C_SYMBOL_DOT_NAME (original)
# else # else
# define weak_alias(original, alias) \ # define weak_alias(original, alias) \

View File

@ -1,5 +1,5 @@
/* Tester for string functions. /* Tester for string functions.
Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc. Copyright (C) 1995-2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -759,23 +759,28 @@ test_strtok_r (void)
{ {
it = "strtok_r"; it = "strtok_r";
(void) strcpy(one, "first, second, third"); (void) strcpy(one, "first, second, third");
cp = NULL; /* Always initialize cp to make sure it doesn't point to some old data. */
equal(strtok_r(one, ", ", &cp), "first", 1); /* Basic test. */ equal(strtok_r(one, ", ", &cp), "first", 1); /* Basic test. */
equal(one, "first", 2); equal(one, "first", 2);
equal(strtok_r((char *)NULL, ", ", &cp), "second", 3); equal(strtok_r((char *)NULL, ", ", &cp), "second", 3);
equal(strtok_r((char *)NULL, ", ", &cp), "third", 4); equal(strtok_r((char *)NULL, ", ", &cp), "third", 4);
check(strtok_r((char *)NULL, ", ", &cp) == NULL, 5); check(strtok_r((char *)NULL, ", ", &cp) == NULL, 5);
(void) strcpy(one, ", first, "); (void) strcpy(one, ", first, ");
cp = NULL;
equal(strtok_r(one, ", ", &cp), "first", 6); /* Extra delims, 1 tok. */ equal(strtok_r(one, ", ", &cp), "first", 6); /* Extra delims, 1 tok. */
check(strtok_r((char *)NULL, ", ", &cp) == NULL, 7); check(strtok_r((char *)NULL, ", ", &cp) == NULL, 7);
(void) strcpy(one, "1a, 1b; 2a, 2b"); (void) strcpy(one, "1a, 1b; 2a, 2b");
cp = NULL;
equal(strtok_r(one, ", ", &cp), "1a", 8); /* Changing delim lists. */ equal(strtok_r(one, ", ", &cp), "1a", 8); /* Changing delim lists. */
equal(strtok_r((char *)NULL, "; ", &cp), "1b", 9); equal(strtok_r((char *)NULL, "; ", &cp), "1b", 9);
equal(strtok_r((char *)NULL, ", ", &cp), "2a", 10); equal(strtok_r((char *)NULL, ", ", &cp), "2a", 10);
(void) strcpy(two, "x-y"); (void) strcpy(two, "x-y");
cp = NULL;
equal(strtok_r(two, "-", &cp), "x", 11); /* New string before done. */ equal(strtok_r(two, "-", &cp), "x", 11); /* New string before done. */
equal(strtok_r((char *)NULL, "-", &cp), "y", 12); equal(strtok_r((char *)NULL, "-", &cp), "y", 12);
check(strtok_r((char *)NULL, "-", &cp) == NULL, 13); check(strtok_r((char *)NULL, "-", &cp) == NULL, 13);
(void) strcpy(one, "a,b, c,, ,d"); (void) strcpy(one, "a,b, c,, ,d");
cp = NULL;
equal(strtok_r(one, ", ", &cp), "a", 14); /* Different separators. */ equal(strtok_r(one, ", ", &cp), "a", 14); /* Different separators. */
equal(strtok_r((char *)NULL, ", ", &cp), "b", 15); equal(strtok_r((char *)NULL, ", ", &cp), "b", 15);
equal(strtok_r((char *)NULL, " ,", &cp), "c", 16); /* Permute list too. */ equal(strtok_r((char *)NULL, " ,", &cp), "c", 16); /* Permute list too. */
@ -783,25 +788,31 @@ test_strtok_r (void)
check(strtok_r((char *)NULL, ", ", &cp) == NULL, 18); check(strtok_r((char *)NULL, ", ", &cp) == NULL, 18);
check(strtok_r((char *)NULL, ", ", &cp) == NULL, 19); /* Persistence. */ check(strtok_r((char *)NULL, ", ", &cp) == NULL, 19); /* Persistence. */
(void) strcpy(one, ", "); (void) strcpy(one, ", ");
cp = NULL;
check(strtok_r(one, ", ", &cp) == NULL, 20); /* No tokens. */ check(strtok_r(one, ", ", &cp) == NULL, 20); /* No tokens. */
(void) strcpy(one, ""); (void) strcpy(one, "");
cp = NULL;
check(strtok_r(one, ", ", &cp) == NULL, 21); /* Empty string. */ check(strtok_r(one, ", ", &cp) == NULL, 21); /* Empty string. */
check(strtok_r((char *)NULL, ", ", &cp) == NULL, 22); /* Persistence. */
(void) strcpy(one, "abc"); (void) strcpy(one, "abc");
equal(strtok_r(one, ", ", &cp), "abc", 22); /* No delimiters. */ cp = NULL;
check(strtok_r((char *)NULL, ", ", &cp) == NULL, 23); equal(strtok_r(one, ", ", &cp), "abc", 23); /* No delimiters. */
check(strtok_r((char *)NULL, ", ", &cp) == NULL, 24);
(void) strcpy(one, "abc"); (void) strcpy(one, "abc");
equal(strtok_r(one, "", &cp), "abc", 24); /* Empty delimiter list. */ cp = NULL;
check(strtok_r((char *)NULL, "", &cp) == NULL, 25); equal(strtok_r(one, "", &cp), "abc", 25); /* Empty delimiter list. */
check(strtok_r((char *)NULL, "", &cp) == NULL, 26);
(void) strcpy(one, "abcdefgh"); (void) strcpy(one, "abcdefgh");
(void) strcpy(one, "a,b,c"); (void) strcpy(one, "a,b,c");
equal(strtok_r(one, ",", &cp), "a", 26); /* Basics again... */ cp = NULL;
equal(strtok_r((char *)NULL, ",", &cp), "b", 27); equal(strtok_r(one, ",", &cp), "a", 27); /* Basics again... */
equal(strtok_r((char *)NULL, ",", &cp), "c", 28); equal(strtok_r((char *)NULL, ",", &cp), "b", 28);
check(strtok_r((char *)NULL, ",", &cp) == NULL, 29); equal(strtok_r((char *)NULL, ",", &cp), "c", 29);
equal(one+6, "gh", 30); /* Stomped past end? */ check(strtok_r((char *)NULL, ",", &cp) == NULL, 30);
equal(one, "a", 31); /* Stomped old tokens? */ equal(one+6, "gh", 31); /* Stomped past end? */
equal(one+2, "b", 32); equal(one, "a", 32); /* Stomped old tokens? */
equal(one+4, "c", 33); equal(one+2, "b", 33);
equal(one+4, "c", 34);
} }
static void static void

View File

@ -16,10 +16,9 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <errno.h>
#include <time.h> #include <time.h>
#include <sys/timeb.h> #include <sys/timeb.h>
#include <sys/time.h>
#include <errno.h>
int int
ftime (timebuf) ftime (timebuf)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1996, 1997, 1999, 2000 Free Software Foundation, Inc. /* Copyright (C) 1991,1996,1997,1999,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -45,7 +45,10 @@ strtok (s, delim)
/* Scan leading delimiters. */ /* Scan leading delimiters. */
s += strspn (s, delim); s += strspn (s, delim);
if (*s == '\0') if (*s == '\0')
return NULL; {
olds = s;
return NULL;
}
/* Find the end of the token. */ /* Find the end of the token. */
token = s; token = s;

View File

@ -1,5 +1,5 @@
/* Reentrant string tokenizer. Generic version. /* Reentrant string tokenizer. Generic version.
Copyright (C) 1991, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. Copyright (C) 1991, 1996, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -46,7 +46,10 @@ __strtok_r (s, delim, save_ptr)
/* Scan leading delimiters. */ /* Scan leading delimiters. */
s += strspn (s, delim); s += strspn (s, delim);
if (*s == '\0') if (*s == '\0')
return NULL; {
*save_ptr = s;
return NULL;
}
/* Find the end of the token. */ /* Find the end of the token. */
token = s; token = s;

View File

@ -5,5 +5,3 @@ kernel_proto.h
bits/utmpx.h bits/utmpx.h
gnu/lib-names.h gnu/lib-names.h
uitrunc.c uitrunc.c
savef.S
restf.S

View File

@ -6,7 +6,7 @@
static-start-installed-name = /usr/lib/crt0.o static-start-installed-name = /usr/lib/crt0.o
ifeq ($(subdir),misc) ifeq ($(subdir),misc)
sysdep_routines += dl-open dl-sym dl-close restf savef uitrunc sysdep_routines += dl-open dl-sym dl-close uitrunc
endif endif
ifeq ($(subdir),login) ifeq ($(subdir),login)

View File

@ -25,6 +25,7 @@
#include <features.h> #include <features.h>
#define __need_NULL
#define __need_size_t #define __need_size_t
#include <stddef.h> #include <stddef.h>

View File

@ -1,58 +0,0 @@
/* Copyright (C) 2000 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
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <sysdep.h>
ENTRY(_restf_all)
ASM_GLOBAL_DIRECTIVE C_TEXT(_restf14)
C_TEXT(_restf14): lfd fp14,-144(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_restf15)
C_TEXT(_restf15): lfd fp15,-136(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_restf16)
C_TEXT(_restf16): lfd fp16,-128(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_restf17)
C_TEXT(_restf17): lfd fp17,-120(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_restf18)
C_TEXT(_restf18): lfd fp18,-112(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_restf19)
C_TEXT(_restf19): lfd fp19,-104(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_restf20)
C_TEXT(_restf20): lfd fp20,-96(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_restf21)
C_TEXT(_restf21): lfd fp21,-88(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_restf22)
C_TEXT(_restf22): lfd fp22,-80(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_restf23)
C_TEXT(_restf23): lfd fp23,-72(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_restf24)
C_TEXT(_restf24): lfd fp24,-64(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_restf25)
C_TEXT(_restf25): lfd fp25,-56(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_restf26)
C_TEXT(_restf26): lfd fp26,-48(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_restf27)
C_TEXT(_restf27): lfd fp27,-40(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_restf28)
C_TEXT(_restf28): lfd fp28,-32(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_restf29)
C_TEXT(_restf29): lfd fp29,-24(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_restf30)
C_TEXT(_restf30): lfd fp30,-16(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_restf31)
C_TEXT(_restf31): lfd fp31,-8(r11)
blr

View File

@ -1,58 +0,0 @@
/* Copyright (C) 2000 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
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <sysdep.h>
ENTRY(_savef_all)
ASM_GLOBAL_DIRECTIVE C_TEXT(_savef14)
C_TEXT(_savef14): stfd fp14,-144(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_savef15)
C_TEXT(_savef15): stfd fp15,-136(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_savef16)
C_TEXT(_savef16): stfd fp16,-128(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_savef17)
C_TEXT(_savef17): stfd fp17,-120(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_savef18)
C_TEXT(_savef18): stfd fp18,-112(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_savef19)
C_TEXT(_savef19): stfd fp19,-104(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_savef20)
C_TEXT(_savef20): stfd fp20,-96(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_savef21)
C_TEXT(_savef21): stfd fp21,-88(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_savef22)
C_TEXT(_savef22): stfd fp22,-80(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_savef23)
C_TEXT(_savef23): stfd fp23,-72(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_savef24)
C_TEXT(_savef24): stfd fp24,-64(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_savef25)
C_TEXT(_savef25): stfd fp25,-56(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_savef26)
C_TEXT(_savef26): stfd fp26,-48(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_savef27)
C_TEXT(_savef27): stfd fp27,-40(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_savef28)
C_TEXT(_savef28): stfd fp28,-32(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_savef29)
C_TEXT(_savef29): stfd fp29,-24(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_savef30)
C_TEXT(_savef30): stfd fp30,-16(r11)
ASM_GLOBAL_DIRECTIVE C_TEXT(_savef31)
C_TEXT(_savef31): stfd fp31,-8(r11)
blr

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1999, 2000 Free Software Foundation, Inc. /* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
@ -32,3 +32,4 @@ __write (fd, ptr, n)
} }
/* AIX has no weak aliases (yet) but let's hope for better times. */ /* AIX has no weak aliases (yet) but let's hope for better times. */
weak_alias (__write, write) weak_alias (__write, write)
strong_alias (__write, __libc_write)