]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
strdup: Assume the function exists.
authorBruno Haible <bruno@clisp.org>
Fri, 14 Aug 2020 17:51:56 +0000 (19:51 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 14 Aug 2020 17:51:56 +0000 (19:51 +0200)
* m4/strdup.m4 (gl_FUNC_STRDUP, gl_FUNC_STRDUP_POSIX): Don't test
whether strdup exists.
* modules/strdup (Files): Remove lib/strdup.c.
(configure.ac): Don't compile strdup.c.
* modules/strdup-posix (Depends-on, configure.ac): Don't test
ac_cv_func_strdup.
* doc/posix-functions/strdup.texi: Update.
* lib/unistr/u8-strdup.c: Assume HAVE_STRDUP is 1.
* modules/unistr/u8-strdup (Files): Remove lib/unistr/u-strdup.h.
(Depends-on): Remove unistr/u8-strlen.

ChangeLog
doc/posix-functions/strdup.texi
lib/unistr/u8-strdup.c
m4/strdup.m4
modules/strdup
modules/strdup-posix
modules/unistr/u8-strdup

index 884be61ee1096619b3b23c3450be6341d6eaa37d..8b0f28706394283dd847a75c8c9825728903082f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2020-08-14  Bruno Haible  <bruno@clisp.org>
+
+       strdup: Assume the function exists.
+       * m4/strdup.m4 (gl_FUNC_STRDUP, gl_FUNC_STRDUP_POSIX): Don't test
+       whether strdup exists.
+       * modules/strdup (Files): Remove lib/strdup.c.
+       (configure.ac): Don't compile strdup.c.
+       * modules/strdup-posix (Depends-on, configure.ac): Don't test
+       ac_cv_func_strdup.
+       * doc/posix-functions/strdup.texi: Update.
+       * lib/unistr/u8-strdup.c: Assume HAVE_STRDUP is 1.
+       * modules/unistr/u8-strdup (Files): Remove lib/unistr/u-strdup.h.
+       (Depends-on): Remove unistr/u8-strlen.
+
 2020-08-13  Bruno Haible  <bruno@clisp.org>
 
        sys_random: Work around an uClibc bug.
index 23f49c7270b93d13838d6a98e933d17db62db4d4..2f337aaec1dd5ed1141ee92be34c173711dc126c 100644 (file)
@@ -9,8 +9,6 @@ Gnulib module: strdup or strdup-posix
 Portability problems fixed by either Gnulib module @code{strdup} or @code{strdup-posix}:
 @itemize
 @item
-This function is missing on some old platforms.
-@item
 This function has no prototype in @code{<string.h>} on some old platforms.
 @end itemize
 
index d3b4c55e6d3f380c0314dc34fef6dd75b7811a7c..663dacbc9e44f622f67bd2065c29c095760405ce 100644 (file)
 /* Specification.  */
 #include "unistr.h"
 
-#if HAVE_STRDUP
-
-# include <string.h>
+#include <string.h>
 
 uint8_t *
 u8_strdup (const uint8_t *s)
 {
   return (uint8_t *) strdup ((const char *) s);
 }
-
-#else
-
-# define FUNC u8_strdup
-# define UNIT uint8_t
-# define U_STRLEN u8_strlen
-# include "u-strdup.h"
-
-#endif
index 2d1fcc416a8f7f0e35058ba5abc875153f9c1a77..63402094229d7b80e0e8fd7454aeba162e399d88 100644 (file)
@@ -1,4 +1,4 @@
-# strdup.m4 serial 13
+# strdup.m4 serial 14
 
 dnl Copyright (C) 2002-2020 Free Software Foundation, Inc.
 
@@ -9,7 +9,6 @@ dnl with or without modifications, as long as this notice is preserved.
 AC_DEFUN([gl_FUNC_STRDUP],
 [
   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
-  AC_CHECK_FUNCS_ONCE([strdup])
   AC_CHECK_DECLS_ONCE([strdup])
   if test $ac_cv_have_decl_strdup = no; then
     HAVE_DECL_STRDUP=0
@@ -20,11 +19,8 @@ AC_DEFUN([gl_FUNC_STRDUP_POSIX],
 [
   AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
   AC_REQUIRE([gl_CHECK_MALLOC_POSIX])
-  AC_CHECK_FUNCS_ONCE([strdup])
-  if test $ac_cv_func_strdup = yes; then
-    if test $gl_cv_func_malloc_posix != yes; then
-      REPLACE_STRDUP=1
-    fi
+  if test $gl_cv_func_malloc_posix != yes; then
+    REPLACE_STRDUP=1
   fi
   AC_CHECK_DECLS_ONCE([strdup])
   if test $ac_cv_have_decl_strdup = no; then
index 619ec01e930654760c174290e550e1896a1a7abb..fecdc554ba3fa96df521d842e9065c26ce116073 100644 (file)
@@ -8,7 +8,6 @@ Notice:
 This module is obsolete. But you may want to use the strdup-posix module.
 
 Files:
-lib/strdup.c
 m4/strdup.m4
 
 Depends-on:
@@ -16,10 +15,6 @@ string
 
 configure.ac:
 gl_FUNC_STRDUP
-if test $ac_cv_func_strdup = no; then
-  AC_LIBOBJ([strdup])
-  gl_PREREQ_STRDUP
-fi
 gl_STRING_MODULE_INDICATOR([strdup])
 
 Makefile.am:
index 846baf2eb81aa235d66e565c838a3eb9b6af5939..a6381f7ac33b1f92a66cc0dfdfb79a098310303f 100644 (file)
@@ -7,11 +7,11 @@ m4/strdup.m4
 
 Depends-on:
 string
-malloc-posix    [test $ac_cv_func_strdup = no || test $REPLACE_STRDUP = 1]
+malloc-posix    [test $REPLACE_STRDUP = 1]
 
 configure.ac:
 gl_FUNC_STRDUP_POSIX
-if test $ac_cv_func_strdup = no || test $REPLACE_STRDUP = 1; then
+if test $REPLACE_STRDUP = 1; then
   AC_LIBOBJ([strdup])
   gl_PREREQ_STRDUP
 fi
index d8da47ea4f338514a035a983dd61c088a0d16f89..598adbb10d9a124d5f0f9db6257e6cdafaca6738 100644 (file)
@@ -3,11 +3,9 @@ Copy UTF-8 string.
 
 Files:
 lib/unistr/u8-strdup.c
-lib/unistr/u-strdup.h
 
 Depends-on:
 unistr/base
-unistr/u8-strlen
 
 configure.ac:
 AC_CHECK_FUNCS_ONCE([strdup])