mirror of
https://https.git.savannah.gnu.org/git/gnulib.git
synced 2026-09-01 02:34:55 +00:00
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.
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
+1
-12
@@ -20,21 +20,10 @@
|
||||
/* 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
|
||||
|
||||
+3
-7
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user