bug-gnulib
[Top][All Lists]
Advanced

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

[bug-gnulib] fix for module 'stpncpy'


From: Bruno Haible
Subject: [bug-gnulib] fix for module 'stpncpy'
Date: Wed, 2 Mar 2005 18:12:24 +0100
User-agent: KMail/1.5

Hi,

I committed this portability fix for 'stpncpy', taken from GNU gettext.

The issue was that AIX has a different function stpncpy, and declares it
in <string.h>. Through AC_DEFINE([stpncpy], [gnu_stpncpy]), the renaming
was done in config.h, and therefore <string.h> actually declared a function
gnu_stpncpy, which then clashed with the prototype in stpncpy.h or the
definition in stpncpy.c. To avoid this, the renaming must be done in
stpncpy.h.


2005-01-28  Bruno Haible  <address@hidden>

        * stpncpy.m4 (gl_FUNC_STPNCPY): Undo the replacement here. Because of
        AIX, the replacement has to be done only after <string.h> is included,
        therefore not in config.h. stpncpy.h does the replacement, and
        stpncpy.c uses it.

2005-01-28  Bruno Haible  <address@hidden>

        * stpncpy.h (stpncpy): Define as a macro without arguments, so that
        stpncpy.c uses it.

*** gnulib/lib/stpncpy.h        2004-07-16 18:06:02.000000000 +0200
--- stpncpy.h   2005-01-28 13:51:07.000000000 +0100
***************
*** 1,5 ****
  /* String copying.
!    Copyright (C) 1995, 2001-2004 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 ----
  /* String copying.
!    Copyright (C) 1995, 2001-2005 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
***************
*** 28,39 ****
  
  #if !HAVE_STPNCPY
  
- /* Copy no more than N bytes of SRC to DST, returning a pointer past the
-    last non-NUL byte written into DST.  */
  /* When not using the GNU libc we use the stpncpy implementation we
     provide here.  */
! extern char *gnu_stpncpy (char *dst, const char *src, size_t n);
! #define stpncpy(Dst, Src, N) gnu_stpncpy (Dst, Src, N)
  
  #endif
  
--- 28,40 ----
  
  #if !HAVE_STPNCPY
  
  /* When not using the GNU libc we use the stpncpy implementation we
     provide here.  */
! #define stpncpy gnu_stpncpy
! 
! /* Copy no more than N bytes of SRC to DST, returning a pointer past the
!    last non-NUL byte written into DST.  */
! extern char *stpncpy (char *dst, const char *src, size_t n);
  
  #endif
  
*** gnulib/m4/stpncpy.m4        2005-01-28 13:41:07.000000000 +0100
--- stpncpy.m4  2005-01-28 13:49:59.000000000 +0100
***************
*** 1,4 ****
! # stpncpy.m4 serial 2
  dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # stpncpy.m4 serial 3
  dnl Copyright (C) 2002-2003, 2005 Free Software Foundation, Inc.
  dnl This file is free software; the Free Software Foundation
  dnl gives unlimited permission to copy and/or distribute it,
***************
*** 49,56 ****
      AC_DEFINE(HAVE_STPNCPY, 1,
        [Define if you have the stpncpy() function and it works.])
    else
-     AC_DEFINE([stpncpy], [gnu_stpncpy],
-       [Define to a replacement function name for stpncpy().])
      AC_LIBOBJ([stpncpy])
      gl_PREREQ_STPNCPY
    fi
--- 49,54 ----





reply via email to

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