From: Bruno Haible Date: Thu, 28 Sep 2006 20:52:13 +0000 (+0000) Subject: Simplify and document. X-Git-Tag: cvs-readonly~1808 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=8da28082747a96bec45bc29ecf346d9b8c4c322d;p=gnulib.git Simplify and document. --- diff --git a/lib/ChangeLog b/lib/ChangeLog index 5619b15a8..0738759c0 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,5 +1,10 @@ 2006-09-28 Bruno Haible + * strndup.h: Simplify the redefinition of strndup. + (_GL_CONCAT, _GL_XCONCAT, __STRNDUP_ID): Remove macros. + +2006-09-28 Bruno Haible + * gl_avltreehash_list.c: Include instead of size_max.h. * gl_linkedhash_list.c: Likewise. * gl_rbtreehash_list.c: Likewise. diff --git a/lib/strndup.h b/lib/strndup.h index b8fb3cb31..b983dd228 100644 --- a/lib/strndup.h +++ b/lib/strndup.h @@ -15,16 +15,17 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include +/* Get size_t. */ #include +/* If HAVE_STRNDUP, get the strndup declaration. + If !HAVE_STRNDUP, include now so that it doesn't cause + trouble if included later. */ +#include -#ifdef __STRNDUP_PREFIX -# define _GL_CONCAT(x, y) x ## y -# define _GL_XCONCAT(x, y) _GL_CONCAT (x, y) -# define __STRNDUP_ID(y) _GL_XCONCAT (__STRNDUP_PREFIX, y) +#if !HAVE_STRNDUP # undef strndup -# define strndup __STRNDUP_ID (strndup) -# if !HAVE_DECL_STRNDUP +# define strndup rpl_strndup +# if !HAVE_DECL_STRNDUP /* Don't risk conflicting declarations. */ /* Return a newly allocated copy of at most N bytes of STRING. */ extern char *strndup (const char *string, size_t n); # endif diff --git a/m4/ChangeLog b/m4/ChangeLog index baf5ee94b..2999054b1 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,7 @@ +2006-09-28 Bruno Haible + + * strndup.m4 (gl_FUNC_STRNDUP): Don't define __STRNDUP_PREFIX. + 2006-09-28 Ralf Wildenhues * intmax.m4 (gt_TYPE_INTMAX_T): Avoid unused variables warning. diff --git a/m4/strndup.m4 b/m4/strndup.m4 index 65a50e821..dd5780b63 100644 --- a/m4/strndup.m4 +++ b/m4/strndup.m4 @@ -1,4 +1,4 @@ -# strndup.m4 serial 10 +# strndup.m4 serial 11 dnl Copyright (C) 2002-2003, 2005-2006 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -39,8 +39,6 @@ AC_DEFUN([gl_FUNC_STRNDUP], AC_DEFINE([HAVE_STRNDUP], 1, [Define if you have the strndup() function and it works.]) else - AC_DEFINE([__STRNDUP_PREFIX], [[rpl_]], - [Define to rpl_ if the strndup replacement function should be used.]) AC_LIBOBJ([strndup]) gl_PREREQ_STRNDUP fi