projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fchdir: another mingw fix
[gnulib.git]
/
lib
/
strndup.c
diff --git
a/lib/strndup.c
b/lib/strndup.c
index
b2d7c0e
..
3a1b0ea
100644
(file)
--- a/
lib/strndup.c
+++ b/
lib/strndup.c
@@
-1,7
+1,7
@@
-/*
Copyright (C) 1996, 1997, 1998, 2000, 2003, 2005 Free Software Foundation, Inc
.
+/*
A replacement function, for systems that lack strndup
.
- NOTE: The canonical source of this file is maintained with the GNU C Library.
-
Bugs can be reported to bug-glibc@prep.ai.mit.edu
.
+ Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2005, 2006, 2007
+
Free Software Foundation, Inc
.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@@
-17,25
+17,14
@@
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
+#include <config.h>
-#include <stdlib.h>
#include <string.h>
#include <string.h>
-/* Get strnlen. */
-#include "strnlen.h"
-
-#undef __strndup
-#undef strndup
-
-#ifndef weak_alias
-# define __strndup strndup
-#endif
+#include <stdlib.h>
char *
char *
-
__strndup (const char
*s, size_t n)
+
strndup (char const
*s, size_t n)
{
size_t len = strnlen (s, n);
char *new = malloc (len + 1);
{
size_t len = strnlen (s, n);
char *new = malloc (len + 1);
@@
-46,6
+35,3
@@
__strndup (const char *s, size_t n)
new[len] = '\0';
return memcpy (new, s, len);
}
new[len] = '\0';
return memcpy (new, s, len);
}
-#ifdef weak_alias
-weak_alias (__strndup, strndup)
-#endif