summaryrefslogtreecommitdiffstats
path: root/lib/strndup.c
diff options
context:
space:
mode:
authorGreg McGary <greg@mcgary.org>1997-04-18 06:43:35 +0000
committerGreg McGary <greg@mcgary.org>1997-04-18 06:43:35 +0000
commit3720d4b7a1b0ce0903450271aa3d93388e9d8781 (patch)
tree12200295d735bf3d1bcaaf8d2065547d41cea3b2 /lib/strndup.c
parent916418ea1284e6aa64f50eba077e48ced5944acc (diff)
downloadidutils-3720d4b7a1b0ce0903450271aa3d93388e9d8781.tar.gz
idutils-3720d4b7a1b0ce0903450271aa3d93388e9d8781.tar.bz2
idutils-3720d4b7a1b0ce0903450271aa3d93388e9d8781.zip
imported from id-utils-3.1r3_1
Diffstat (limited to 'lib/strndup.c')
-rw-r--r--lib/strndup.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/strndup.c b/lib/strndup.c
index 556215d..1694d73 100644
--- a/lib/strndup.c
+++ b/lib/strndup.c
@@ -15,22 +15,22 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
+#include <config.h>
#include <ansidecl.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
+#include "xstring.h"
+#include "xmalloc.h"
/* Duplicate S, returning an identical malloc'd string. */
char *
-DEFUN(strndup, (s, n), CONST char *s AND size_t n)
+DEFUN(strndup, (s, n), const char *s AND size_t n)
{
char *new = malloc(n + 1);
if (new == NULL)
return NULL;
- memcpy (new, (PTR) s, n);
+ memcpy (new, s, n);
new[n] = '\0';
return new;