1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-06-25 12:42:04 +03:00
Files
aout
argp
assert
bare
bits
catgets
conf
conform
csu
ctype
db
db2
debug
dirent
dlfcn
elf
gmon
gnulib
grp
hesiod
hurd
iconv
iconvdata
include
inet
intl
io
libio
linuxthreads
linuxthreads_db
locale
localedata
login
mach
malloc
manual
math
md5-crypt
misc
nis
nscd
nss
po
posix
pwd
resolv
resource
rpm
rt
scripts
setjmp
shadow
signal
socket
stdio
stdio-common
stdlib
streams
string
bits
.cvsignore
Makefile
Versions
argz-addsep.c
argz-append.c
argz-count.c
argz-create.c
argz-ctsep.c
argz-delete.c
argz-extract.c
argz-insert.c
argz-next.c
argz-replace.c
argz-stringify.c
argz.h
basename.c
byteswap.h
endian.h
envz.c
envz.h
inl-tester.c
memfrob.c
memory.h
noinl-tester.c
stratcliff.c
strcoll.c
strcoll_l.c
strdup.c
strerror.c
strfry.c
string-inlines.c
string.h
strings.h
strndup.c
strnlen.c
strsignal.c
strverscmp.c
strxfrm.c
strxfrm_l.c
swab.c
test-ffs.c
testcopy.c
tester.c
tst-inlcall.c
tst-strlen.c
tst-svc.c
tst-svc.expect
tst-svc.input
sunrpc
sysdeps
sysvipc
termios
time
timezone
wcsmbs
wctype
.cvsignore
BUGS
CONFORMANCE
COPYING
COPYING.LIB
ChangeLog
ChangeLog.1
ChangeLog.2
ChangeLog.3
ChangeLog.4
ChangeLog.5
ChangeLog.6
ChangeLog.7
ChangeLog.8
ChangeLog.9
FAQ
FAQ.in
INSTALL
INTERFACE
Make-dist
MakeTAGS
Makeconfig
Makefile
Makefile.in
Makerules
NAMESPACE
NEWS
NOTES
PROJECTS
README
README-alpha
README.libm
README.template
Rules
Versions.def
abi-tags
aclocal.m4
config-name.in
config.h.in
config.make.in
configure
configure.in
extra-lib.mk
glibcbug.in
o-iterator.mk
shlib-versions
test-skeleton.c
version.h
glibc/string/strdup.c
Ulrich Drepper 7551a1e510 Update.
1998-03-18  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* manual/memory.texi (Heap Consistency Checking): Document
	MALLOC_CHECK_.  Based on a text by Wolfram Gloger.

1998-03-18 17:11  Zack Weinberg  <zack@rabi.phys.columbia.edu>

	* manual/Makefile: Add missing rules.

1998-03-18  Ulrich Drepper  <drepper@cygnus.com>

	* timezone/Makefile (generated): Define to remove all stamp files.

	* sysdeps/generic/strsep.c: Also undefine __strsep.

	* string/strdup.c: Undefine __strdup and strdup first.
	* string/strndup.c: Likewise.

	* string/bits/string2.h: Correct strtok_r and strsep.
	Add strndup optimization.

	* sysdeps/generic/strsep.c: Little optimization.
1998-03-18 17:57:13 +00:00

53 lines
1.4 KiB
C

/* Copyright (C) 1991, 1996, 1997, 1998 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. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#if defined _LIBC || defined STDC_HEADERS
# include <stdlib.h>
# include <string.h>
#else
char *malloc ();
char *memcpy ();
#endif
#undef __strdup
#undef strdup
#ifndef weak_alias
# define __strdup strdup
#endif
/* Duplicate S, returning an identical malloc'd string. */
char *
__strdup (const char *s)
{
size_t len = strlen (s) + 1;
void *new = malloc (len);
if (new == NULL)
return NULL;
return (char *) memcpy (new, s, len);
}
#ifdef weak_alias
weak_alias (__strdup, strdup)
#endif