diff options
author | Guido van Rossum <guido@python.org> | 1997-11-04 20:22:24 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-11-04 20:22:24 (GMT) |
commit | 851e7d51592693ec8da667dcddd6e726b03f9868 (patch) | |
tree | 304868678ffdfdf0d8dea9bd379f9bada40066f5 /Modules | |
parent | 4a1f39a26bd5ff97f0388b2a35ea6edf089a0e07 (diff) | |
download | cpython-851e7d51592693ec8da667dcddd6e726b03f9868.zip cpython-851e7d51592693ec8da667dcddd6e726b03f9868.tar.gz cpython-851e7d51592693ec8da667dcddd6e726b03f9868.tar.bz2 |
Got rid of the errorstr dictionary, which is redundant now that
there's os.strerror() -- also, it would form a locale liability.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/errnomodule.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/Modules/errnomodule.c b/Modules/errnomodule.c index be36ca6..2b15d71f 100644 --- a/Modules/errnomodule.c +++ b/Modules/errnomodule.c @@ -54,57 +54,45 @@ static PyMethodDef errno_methods[] = { /* Helper function doing the dictionary inserting */ static void -inscode(d, e, c, name, code, comment) - PyObject * d; - PyObject * e; - PyObject * c; +_inscode(d, de, name, code) + PyObject *d; + PyObject *de; char *name; int code; - char * comment; { PyObject *u; PyObject *v; - PyObject *w; - -#ifdef HAVE_STRERROR - if (strerror(code) != NULL) - comment = strerror(code); -#endif u = PyString_FromString(name); v = PyInt_FromLong((long) code); - w = PyString_FromString(comment); - if (!u || !v || !w) { + if (!u || !v) { /* Don't bother reporting this error */ PyErr_Clear(); } else { /* insert in modules dict */ PyDict_SetItem(d, u, v); - /* insert in errorstr dict */ - PyDict_SetItem(e, v, w); /* insert in errorcode dict */ - PyDict_SetItem(c, v, u); + PyDict_SetItem(de, v, u); } Py_XDECREF(u); Py_XDECREF(v); - Py_XDECREF(w); } void initerrno() { - PyObject *m, *d, *ds, *de; + PyObject *m, *d, *de; m = Py_InitModule("errno", errno_methods); d = PyModule_GetDict(m); - ds = PyDict_New(); - if (ds == NULL || PyDict_SetItemString(d,"errorstr",ds)) - Py_FatalError("can't initialize errno module"); de = PyDict_New(); if (de == NULL || PyDict_SetItemString(d,"errorcode",de)) Py_FatalError("can't initialize errno module"); +/* Macro so I don't have to edit each and every line below... */ +#define inscode(d, ds, de, name, code, comment) _inscode(d, de, name, code) + /* * The names and comments are borrowed from linux/include/errno.h, * which should be pretty all-inclusive |