mirror of
https://github.com/python/cpython.git
synced 2025-07-29 14:15:07 +00:00
Remove our implementation of memmove() and strerror(); both are in the C89
standard library.
This commit is contained in:
parent
b7ec8e5a9e
commit
aa5778d1b8
6 changed files with 105 additions and 52 deletions
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue