diff --git a/CMake/unix-cache.cmake b/CMake/unix-cache.cmake index fac54cd0fb..1c6add8397 100644 --- a/CMake/unix-cache.cmake +++ b/CMake/unix-cache.cmake @@ -246,7 +246,6 @@ set(HAVE_STDDEF_H 1) # detected by CMake internally in check_type_size() set(HAVE_STDINT_H 1) # detected by CMake internally in check_type_size() set(HAVE_STRCASECMP 1) set(HAVE_STRCMPI 0) -set(HAVE_STRDUP 1) set(HAVE_STRERROR_R 1) set(HAVE_STRICMP 0) set(HAVE_STRINGS_H 1) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b324e9585..6663919851 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1612,7 +1612,6 @@ if(NOT WIN32) check_function_exists("realpath" HAVE_REALPATH) check_function_exists("sched_yield" HAVE_SCHED_YIELD) check_symbol_exists("strcasecmp" "string.h" HAVE_STRCASECMP) - check_symbol_exists("strdup" "string.h" HAVE_STRDUP) check_symbol_exists("stricmp" "string.h" HAVE_STRICMP) check_symbol_exists("strcmpi" "string.h" HAVE_STRCMPI) endif() diff --git a/configure.ac b/configure.ac index f400a02076..827f5f17a0 100644 --- a/configure.ac +++ b/configure.ac @@ -4204,7 +4204,6 @@ if test "$curl_cv_native_windows" != "yes"; then CURL_CHECK_FUNC_INET_PTON CURL_CHECK_FUNC_STRCASECMP CURL_CHECK_FUNC_STRCMPI - CURL_CHECK_FUNC_STRDUP CURL_CHECK_FUNC_STRICMP fi diff --git a/lib/config-os400.h b/lib/config-os400.h index 294d512a9f..8071b8ad4e 100644 --- a/lib/config-os400.h +++ b/lib/config-os400.h @@ -148,9 +148,6 @@ /* Define if you have the `stricmp' function. */ #define HAVE_STRICMP -/* Define if you have the `strdup' function. */ -#define HAVE_STRDUP - /* Define if you have the header file. */ #define HAVE_STRINGS_H diff --git a/lib/config-riscos.h b/lib/config-riscos.h index 43f33e5086..9f585565d8 100644 --- a/lib/config-riscos.h +++ b/lib/config-riscos.h @@ -129,9 +129,6 @@ /* Define if you have the `strcmpi' function. */ #undef HAVE_STRCMPI -/* Define if you have the `strdup' function. */ -#define HAVE_STRDUP - /* Define if you have the `stricmp' function. */ #define HAVE_STRICMP diff --git a/lib/curl_config-cmake.h.in b/lib/curl_config-cmake.h.in index a418b16748..9f9c60015e 100644 --- a/lib/curl_config-cmake.h.in +++ b/lib/curl_config-cmake.h.in @@ -535,9 +535,6 @@ /* Define to 1 if you have the strcmpi function. */ #cmakedefine HAVE_STRCMPI 1 -/* Define to 1 if you have the strdup function. */ -#cmakedefine HAVE_STRDUP 1 - /* Define to 1 if you have the strerror_r function. */ #cmakedefine HAVE_STRERROR_R 1 diff --git a/lib/curl_setup.h b/lib/curl_setup.h index 6f564eff1e..10cdb563d1 100644 --- a/lib/curl_setup.h +++ b/lib/curl_setup.h @@ -1079,8 +1079,6 @@ CURL_EXTERN ALLOC_FUNC FILE *curl_dbg_fdopen(int filedes, const char *mode, #ifdef _WIN32 #define CURLX_STRDUP_LOW _strdup -#elif !defined(HAVE_STRDUP) -#define CURLX_STRDUP_LOW curlx_strdup_low #else #define CURLX_STRDUP_LOW strdup #endif diff --git a/lib/curlx/strdup.c b/lib/curlx/strdup.c index 59031bcf13..75e088fe4c 100644 --- a/lib/curlx/strdup.c +++ b/lib/curlx/strdup.c @@ -49,24 +49,6 @@ wchar_t *curlx_wcsdup(const wchar_t *src) return (wchar_t *)curlx_memdup(src, (length + 1) * sizeof(wchar_t)); } -#elif !defined(HAVE_STRDUP) -char *curlx_strdup_low(const char *str) -{ - size_t len; - char *newstr; - - if(!str) - return NULL; - - len = strlen(str) + 1; - - newstr = curlx_malloc(len); - if(!newstr) - return NULL; - - memcpy(newstr, str, len); - return newstr; -} #endif /*************************************************************************** diff --git a/lib/curlx/strdup.h b/lib/curlx/strdup.h index eac4039b38..1e6bc19814 100644 --- a/lib/curlx/strdup.h +++ b/lib/curlx/strdup.h @@ -27,8 +27,6 @@ #ifdef _WIN32 wchar_t *curlx_wcsdup(const wchar_t *src); /* for curlx_tcsdup() */ -#elif !defined(HAVE_STRDUP) -char *curlx_strdup_low(const char *str); #endif void *curlx_memdup(const void *src, size_t buffer_length); void *curlx_memdup0(const char *src, size_t length); diff --git a/m4/curl-functions.m4 b/m4/curl-functions.m4 index 52885d84a8..f4fbe3ad78 100644 --- a/m4/curl-functions.m4 +++ b/m4/curl-functions.m4 @@ -3935,92 +3935,6 @@ AC_DEFUN([CURL_CHECK_FUNC_STRCMPI], [ ]) -dnl CURL_CHECK_FUNC_STRDUP -dnl ------------------------------------------------- -dnl Verify if strdup is available, prototyped, and -dnl can be compiled. If all of these are true, and -dnl usage has not been previously disallowed with -dnl shell variable curl_disallow_strdup, then -dnl HAVE_STRDUP will be defined. - -AC_DEFUN([CURL_CHECK_FUNC_STRDUP], [ - AC_REQUIRE([CURL_INCLUDES_STRING])dnl - AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl - # - tst_links_strdup="unknown" - tst_proto_strdup="unknown" - tst_compi_strdup="unknown" - tst_allow_strdup="unknown" - # - AC_MSG_CHECKING([if strdup can be linked]) - AC_LINK_IFELSE([ - AC_LANG_FUNC_LINK_TRY([strdup]) - ],[ - AC_MSG_RESULT([yes]) - tst_links_strdup="yes" - ],[ - AC_MSG_RESULT([no]) - tst_links_strdup="no" - ]) - # - if test "$tst_links_strdup" = "yes"; then - AC_MSG_CHECKING([if strdup is prototyped]) - AC_EGREP_CPP([strdup],[ - $curl_includes_string - ],[ - AC_MSG_RESULT([yes]) - tst_proto_strdup="yes" - ],[ - AC_MSG_RESULT([no]) - tst_proto_strdup="no" - ]) - fi - # - if test "$tst_proto_strdup" = "yes"; then - AC_MSG_CHECKING([if strdup is compilable]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - $curl_includes_string - $curl_includes_stdlib - ]],[[ - free(strdup("")); - ]]) - ],[ - AC_MSG_RESULT([yes]) - tst_compi_strdup="yes" - ],[ - AC_MSG_RESULT([no]) - tst_compi_strdup="no" - ]) - fi - # - if test "$tst_compi_strdup" = "yes"; then - AC_MSG_CHECKING([if strdup usage allowed]) - if test "x$curl_disallow_strdup" != "xyes"; then - AC_MSG_RESULT([yes]) - tst_allow_strdup="yes" - else - AC_MSG_RESULT([no]) - tst_allow_strdup="no" - fi - fi - # - AC_MSG_CHECKING([if strdup might be used]) - if test "$tst_links_strdup" = "yes" && - test "$tst_proto_strdup" = "yes" && - test "$tst_compi_strdup" = "yes" && - test "$tst_allow_strdup" = "yes"; then - AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(HAVE_STRDUP, 1, - [Define to 1 if you have the strdup function.]) - curl_cv_func_strdup="yes" - else - AC_MSG_RESULT([no]) - curl_cv_func_strdup="no" - fi -]) - - dnl CURL_CHECK_FUNC_STRERROR_R dnl ------------------------------------------------- dnl Verify if strerror_r is available, prototyped, can be compiled and