bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnulib] xalloc: add xstrndup


From: Simon Josefsson
Subject: Re: [Bug-gnulib] xalloc: add xstrndup
Date: Sun, 17 Aug 2003 19:16:17 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

Bruno Haible <address@hidden> writes:

> Thanks, this was better. But you forgot to send the xstrndup.h file;
> the xstrndup.c file doesn't need to check for <string.h>; size_t is
> found in <stddef.h> which is more standard than <sys/types.h>; and
> finally you didn't provide a function prototype for strndup() on
> non-glibc systems.

Oops, sorry!

The xstrndup.c file was based on xstrdup.c, so perhaps the following
is useful, to propagate your fixes back to the source?  I notice that
several other files do check for string.h/strings.h though, is this
required only in some files?

Thanks.

--- xstrdup.c.~1.8.~    Thu Jan  1 01:00:01 1970
+++ xstrdup.c   Sun Aug 17 19:14:25 2003
@@ -1,5 +1,5 @@
 /* xstrdup.c -- copy a string with out of memory checking
-   Copyright (C) 1990, 1996, 1998, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1990, 1996, 1998, 2001, 2003 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
@@ -19,13 +19,8 @@
 # include <config.h>
 #endif
 
-#if STDC_HEADERS || HAVE_STRING_H
+#include <stddef.h>
 # include <string.h>
-#else
-# include <strings.h>
-#endif
-
-#include <sys/types.h>
 
 #include "xalloc.h"
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]