[Python-checkins] bpo-41340: Removed fallback implementation for strdup (GH-21634)

wasiher webhook-mailer at python.org
Sun Jul 26 23:28:53 EDT 2020


https://github.com/python/cpython/commit/5798f787779006a94a55ec74a86da4627de90146
commit: 5798f787779006a94a55ec74a86da4627de90146
branch: master
author: wasiher <watashiwaher at gmail.com>
committer: GitHub <noreply at github.com>
date: 2020-07-27T12:28:45+09:00
summary:

bpo-41340: Removed fallback implementation for strdup (GH-21634)

files:
A Misc/NEWS.d/next/Core and Builtins/2020-07-27-01-50-06.bpo-41340.pZXfcF.rst
D Python/strdup.c
M configure
M configure.ac
M pyconfig.h.in

diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-07-27-01-50-06.bpo-41340.pZXfcF.rst b/Misc/NEWS.d/next/Core and Builtins/2020-07-27-01-50-06.bpo-41340.pZXfcF.rst
new file mode 100644
index 0000000000000..3a93a57693107
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2020-07-27-01-50-06.bpo-41340.pZXfcF.rst	
@@ -0,0 +1 @@
+Removed fallback implementation for ``strdup``.
diff --git a/Python/strdup.c b/Python/strdup.c
deleted file mode 100644
index 6ce171b21fe6c..0000000000000
--- a/Python/strdup.c
+++ /dev/null
@@ -1,12 +0,0 @@
-/* strdup() replacement (from stdwin, if you must know) */
-
-char *
-strdup(const char *str)
-{
-    if (str != NULL) {
-        char *copy = malloc(strlen(str) + 1);
-        if (copy != NULL)
-            return strcpy(copy, str);
-    }
-    return NULL;
-}
diff --git a/configure b/configure
index 5024860ca4395..69e975a4e8ef3 100755
--- a/configure
+++ b/configure
@@ -12829,19 +12829,6 @@ esac
 
 fi
 
-ac_fn_c_check_func "$LINENO" "strdup" "ac_cv_func_strdup"
-if test "x$ac_cv_func_strdup" = xyes; then :
-  $as_echo "#define HAVE_STRDUP 1" >>confdefs.h
-
-else
-  case " $LIBOBJS " in
-  *" strdup.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS strdup.$ac_objext"
- ;;
-esac
-
-fi
-
 
 for ac_func in getpgrp
 do :
diff --git a/configure.ac b/configure.ac
index 5a3e340aa3e72..07c0585432b06 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3970,7 +3970,7 @@ AC_CHECK_FUNCS(forkpty,,
 # check for long file support functions
 AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
 
-AC_REPLACE_FUNCS(dup2 strdup)
+AC_REPLACE_FUNCS(dup2)
 AC_CHECK_FUNCS(getpgrp,
   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]], [[getpgrp(0);]])],
     [AC_DEFINE(GETPGRP_HAVE_ARG, 1, [Define if getpgrp() must be called as getpgrp(0).])],
diff --git a/pyconfig.h.in b/pyconfig.h.in
index bc906a869b623..c162a3c33e57b 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -1034,9 +1034,6 @@
 /* Has stdatomic.h with atomic_int and atomic_uintptr_t */
 #undef HAVE_STD_ATOMIC
 
-/* Define to 1 if you have the `strdup' function. */
-#undef HAVE_STRDUP
-
 /* Define to 1 if you have the `strftime' function. */
 #undef HAVE_STRFTIME
 



More information about the Python-checkins mailing list