]> granicus.if.org Git - python/commitdiff
Remove all traces of HAVE_STRERROR.
authorBrett Cannon <bcannon@gmail.com>
Tue, 18 Mar 2008 15:35:58 +0000 (15:35 +0000)
committerBrett Cannon <bcannon@gmail.com>
Tue, 18 Mar 2008 15:35:58 +0000 (15:35 +0000)
The removal of strerror.c led to the function check being removed from
configure.in.

Modules/_fileio.c
Modules/main.c
Modules/posixmodule.c
Modules/socketmodule.c
Objects/fileobject.c

index bf527073481119ff77bbb3e2e89159fb36c1cd26..00689b3238ac836ec5da370a16d0cb24fa2ab434 100644 (file)
@@ -104,11 +104,7 @@ dircheck(PyFileIOObject* self)
        if (self->fd < 0)
                return 0;
        if (fstat(self->fd, &buf) == 0 && S_ISDIR(buf.st_mode)) {
-#ifdef HAVE_STRERROR
                char *msg = strerror(EISDIR);
-#else
-               char *msg = "Is a directory";
-#endif
                PyObject *exc;
                internal_close(self);
 
@@ -295,12 +291,8 @@ fileio_dealloc(PyFileIOObject *self)
        if (self->fd >= 0 && self->closefd) {
                errno = internal_close(self);
                if (errno < 0) {
-#ifdef HAVE_STRERROR
                        PySys_WriteStderr("close failed: [Errno %d] %s\n",
                                           errno, strerror(errno));
-#else
-                       PySys_WriteStderr("close failed: [Errno %d]\n", errno);
-#endif
                }
        }
 
index e6409e84a26e4762ead85a27b43732363a67f66b..0cd879de6df9f72d535d4a350ffbdd90bbe9509c 100644 (file)
@@ -539,13 +539,9 @@ Py_Main(int argc, char **argv)
 
                if (sts==-1 && filename!=NULL) {
                        if ((fp = fopen(filename, "r")) == NULL) {
-#ifdef HAVE_STRERROR
                                fprintf(stderr, "%s: can't open file '%s': [Errno %d] %s\n",
                                        argv[0], filename, errno, strerror(errno));
-#else
-                               fprintf(stderr, "%s: can't open file '%s': Errno %d\n",
-                                       argv[0], filename, errno);
-#endif
+
                                return 2;
                        }
                        else if (skipfirstline) {
index fab44d6aa481b9e9870e9be1732411bc3af6ec89..f73b73e043c55fd09f22c0f1ba638defc53f4607 100644 (file)
@@ -6710,7 +6710,6 @@ posix_unsetenv(PyObject *self, PyObject *args)
 }
 #endif /* unsetenv */
 
-#ifdef HAVE_STRERROR
 PyDoc_STRVAR(posix_strerror__doc__,
 "strerror(code) -> string\n\n\
 Translate an error code to a message string.");
@@ -6730,7 +6729,6 @@ posix_strerror(PyObject *self, PyObject *args)
        }
        return PyString_FromString(message);
 }
-#endif /* strerror */
 
 
 #ifdef HAVE_SYS_WAIT_H
@@ -8510,9 +8508,7 @@ static PyMethodDef posix_methods[] = {
 #ifdef HAVE_UNSETENV
        {"unsetenv",    posix_unsetenv, METH_VARARGS, posix_unsetenv__doc__},
 #endif
-#ifdef HAVE_STRERROR
        {"strerror",    posix_strerror, METH_VARARGS, posix_strerror__doc__},
-#endif
 #ifdef HAVE_FCHDIR
        {"fchdir",      posix_fchdir, METH_O, posix_fchdir__doc__},
 #endif
index d5114e87686c0feccfdfbd2f3878523a5ac2d0dc..13354d022ca627f67524d6fddcd62fdbf5481fbf 100644 (file)
@@ -3110,15 +3110,10 @@ gethost_common(struct hostent *h, struct sockaddr *addr, int alen, int af)
        }
 
        if (h->h_addrtype != af) {
-#ifdef HAVE_STRERROR
                /* Let's get real error message to return */
                PyErr_SetString(socket_error,
                                (char *)strerror(EAFNOSUPPORT));
-#else
-               PyErr_SetString(
-                       socket_error,
-                       "Address family not supported by protocol family");
-#endif
+
                return NULL;
        }
 
index 6f8eb7c65c678216b1bcbf62f88e802d14e55140..9195a24ea113940acee78e6d18efdb4038555c29 100644 (file)
@@ -83,11 +83,7 @@ dircheck(PyFileObject* f)
                return f;
        if (fstat(fileno(f->f_fp), &buf) == 0 &&
            S_ISDIR(buf.st_mode)) {
-#ifdef HAVE_STRERROR
                char *msg = strerror(EISDIR);
-#else
-               char *msg = "Is a directory";
-#endif
                PyObject *exc = PyObject_CallFunction(PyExc_IOError, "(is)",
                                                      EISDIR, msg);
                PyErr_SetObject(PyExc_IOError, exc);
@@ -398,11 +394,7 @@ file_dealloc(PyFileObject *f)
                sts = (*f->f_close)(f->f_fp);
                Py_END_ALLOW_THREADS
                if (sts == EOF) 
-#ifdef HAVE_STRERROR
                        PySys_WriteStderr("close failed: [Errno %d] %s\n", errno, strerror(errno)); 
-#else
-                       PySys_WriteStderr("close failed: [Errno %d]\n", errno); 
-#endif
        }
        PyMem_Free(f->f_setbuf);
        Py_XDECREF(f->f_name);