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: Bruno Haible
Subject: Re: [Bug-gnulib] xalloc: add xstrndup
Date: Mon, 18 Aug 2003 19:13:02 +0200
User-agent: KMail/1.5

Simon Josefsson wrote:

> 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?

You are right; the stuff still using HAVE_STRING_H is obsolete now that
we require C89 support (remember that <strings.h> was needed on very old
BSD Unix only).

Any objections against this patch?

Bruno


*** lib/xstrdup.c       30 Nov 2001 14:32:22 -0000      1.8
--- lib/xstrdup.c       18 Aug 2003 17:12:12 -0000
***************
*** 1,5 ****
  /* xstrdup.c -- copy a string with out of memory checking
!    Copyright (C) 1990, 1996, 1998, 2001 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
--- 1,5 ----
  /* xstrdup.c -- copy a string with out of memory checking
!    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,33 ****
  # include <config.h>
  #endif
  
! #if STDC_HEADERS || HAVE_STRING_H
! # include <string.h>
! #else
! # include <strings.h>
! #endif
! 
! #include <sys/types.h>
! 
  #include "xalloc.h"
  
  /* Return a newly allocated copy of STRING.  */
  
--- 19,28 ----
  # include <config.h>
  #endif
  
! /* Specification.  */
  #include "xalloc.h"
+ 
+ #include <string.h>
  
  /* Return a newly allocated copy of STRING.  */
  
*** m4/xalloc.m4        31 Dec 2002 13:42:07 -0000      1.1
--- m4/xalloc.m4        18 Aug 2003 17:12:12 -0000
***************
*** 1,5 ****
! # xalloc.m4 serial 1
! dnl Copyright (C) 2002 Free Software Foundation, Inc.
  dnl This file is free software, distributed under the terms of the GNU
  dnl General Public License.  As a special exception to the GNU General
  dnl Public License, this file may be distributed as part of a program
--- 1,5 ----
! # xalloc.m4 serial 2
! dnl Copyright (C) 2002-2003 Free Software Foundation, Inc.
  dnl This file is free software, distributed under the terms of the GNU
  dnl General Public License.  As a special exception to the GNU General
  dnl Public License, this file may be distributed as part of a program
***************
*** 21,26 ****
  
  # Prerequisites of lib/xstrdup.c.
  AC_DEFUN([gl_PREREQ_XSTRDUP], [
!   AC_REQUIRE([AC_HEADER_STDC])
!   AC_CHECK_HEADERS_ONCE(string.h)
  ])
--- 21,25 ----
  
  # Prerequisites of lib/xstrdup.c.
  AC_DEFUN([gl_PREREQ_XSTRDUP], [
!   :
  ])





reply via email to

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