summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2008-03-18 04:09:00 (GMT)
committerBrett Cannon <bcannon@gmail.com>2008-03-18 04:09:00 (GMT)
commitaa5778d1b886f7a4e47855229c8b223b6b39e317 (patch)
tree1a091419eea1f0060e3e46741b63cd24b9257c2d
parentb7ec8e5a9e1e48aed6c217f505fa38b7461e0989 (diff)
downloadcpython-aa5778d1b886f7a4e47855229c8b223b6b39e317.zip
cpython-aa5778d1b886f7a4e47855229c8b223b6b39e317.tar.gz
cpython-aa5778d1b886f7a4e47855229c8b223b6b39e317.tar.bz2
Remove our implementation of memmove() and strerror(); both are in the C89
standard library.
-rw-r--r--Misc/NEWS3
-rw-r--r--Python/memmove.c25
-rw-r--r--Python/strerror.c19
-rwxr-xr-xconfigure102
-rw-r--r--configure.in5
-rw-r--r--pyconfig.h.in3
6 files changed, 105 insertions, 52 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 890b7f7..78aa5f9 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -102,6 +102,9 @@ Tests
Build
-----
+- Python/memmove.c and Python/strerror.c have been removed; both functions are
+ in the C89 standard library.
+
- Patch #2284: Add -x64 option to rt.bat.
What's New in Python 2.6 alpha 1?
diff --git a/Python/memmove.c b/Python/memmove.c
deleted file mode 100644
index 6fb0dad..0000000
--- a/Python/memmove.c
+++ /dev/null
@@ -1,25 +0,0 @@
-
-/* A perhaps slow but I hope correct implementation of memmove */
-
-extern char *memcpy(char *, char *, int);
-
-char *
-memmove(char *dst, char *src, int n)
-{
- char *realdst = dst;
- if (n <= 0)
- return dst;
- if (src >= dst+n || dst >= src+n)
- return memcpy(dst, src, n);
- if (src > dst) {
- while (--n >= 0)
- *dst++ = *src++;
- }
- else if (src < dst) {
- src += n;
- dst += n;
- while (--n >= 0)
- *--dst = *--src;
- }
- return realdst;
-}
diff --git a/Python/strerror.c b/Python/strerror.c
deleted file mode 100644
index 55f8342..0000000
--- a/Python/strerror.c
+++ /dev/null
@@ -1,19 +0,0 @@
-
-/* PD implementation of strerror() for systems that don't have it.
- Author: Guido van Rossum, CWI Amsterdam, Oct. 1990, <guido@cwi.nl>. */
-
-#include <stdio.h>
-#include "Python.h"
-
-extern int sys_nerr;
-extern char *sys_errlist[];
-
-char *
-strerror(int err)
-{
- static char buf[20];
- if (err >= 0 && err < sys_nerr)
- return sys_errlist[err];
- PyOS_snprintf(buf, sizeof(buf), "Unknown errno %d", err);
- return buf;
-}
diff --git a/configure b/configure
index c7f6058..99f5cb0 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in Revision: 61234 .
+# From configure.in Revision: 61436 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for python 2.6.
#
@@ -17201,6 +17201,102 @@ fi
done
+# Stuff for expat.
+
+for ac_func in memmove
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
# check for long file support functions
@@ -17305,9 +17401,7 @@ done
-
-
-for ac_func in dup2 getcwd strdup strerror memmove
+for ac_func in dup2 getcwd strdup
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
diff --git a/configure.in b/configure.in
index 767766c..0d352fa 100644
--- a/configure.in
+++ b/configure.in
@@ -2527,10 +2527,13 @@ AC_CHECK_FUNCS(forkpty,,
)
)
+# Stuff for expat.
+AC_CHECK_FUNCS(memmove)
+
# check for long file support functions
AC_CHECK_FUNCS(fseek64 fseeko fstatvfs ftell64 ftello statvfs)
-AC_REPLACE_FUNCS(dup2 getcwd strdup strerror memmove)
+AC_REPLACE_FUNCS(dup2 getcwd strdup)
AC_CHECK_FUNCS(getpgrp,
AC_TRY_COMPILE([#include <unistd.h>],
[getpgrp(0);],
diff --git a/pyconfig.h.in b/pyconfig.h.in
index 35a873a..4d43a21 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -571,9 +571,6 @@
/* Define to 1 if you have the `strdup' function. */
#undef HAVE_STRDUP
-/* Define to 1 if you have the `strerror' function. */
-#undef HAVE_STRERROR
-
/* Define to 1 if you have the `strftime' function. */
#undef HAVE_STRFTIME