diff options
author | Guido van Rossum <guido@python.org> | 1996-12-10 00:32:31 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1996-12-10 00:32:31 (GMT) |
commit | 55db515a51468bb2f1ca2a61c9756dea88b79d58 (patch) | |
tree | 688e436011c981c13a12b2a3d94c52fd2d12e3a4 | |
parent | 09f99dfdba1c34ab90c72522830fd69c3ddface7 (diff) | |
download | cpython-55db515a51468bb2f1ca2a61c9756dea88b79d58.zip cpython-55db515a51468bb2f1ca2a61c9756dea88b79d58.tar.gz cpython-55db515a51468bb2f1ca2a61c9756dea88b79d58.tar.bz2 |
Great renaming.
Also got rid of the dummy variable, which was last needed in IRIX 4.x.
-rw-r--r-- | Modules/sgimodule.c | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/Modules/sgimodule.c b/Modules/sgimodule.c index 49087b2..1943040 100644 --- a/Modules/sgimodule.c +++ b/Modules/sgimodule.c @@ -31,55 +31,52 @@ PERFORMANCE OF THIS SOFTWARE. /* SGI module -- random SGI-specific things */ -#include "allobjects.h" -#include "modsupport.h" -#include "ceval.h" +#include "Python.h" -#include <errno.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <fcntl.h> -static object * +static PyObject * sgi_nap(self, args) - object *self; - object *args; + PyObject *self; + PyObject *args; { long ticks; - if (!getargs(args, "l", &ticks)) + if (!PyArg_Parse(args, "l", &ticks)) return NULL; - BGN_SAVE + Py_BEGIN_ALLOW_THREADS sginap(ticks); - END_SAVE - INCREF(None); - return None; + Py_END_ALLOW_THREADS + Py_INCREF(Py_None); + return Py_None; } extern char *_getpty(int *, int, mode_t, int); -static object * +static PyObject * sgi__getpty(self, args) - object *self; - object *args; + PyObject *self; + PyObject *args; { int oflag; int mode; int nofork; char *name; int fildes; - if (!getargs(args, "(iii)", &oflag, &mode, &nofork)) + if (!PyArg_Parse(args, "(iii)", &oflag, &mode, &nofork)) return NULL; errno = 0; name = _getpty(&fildes, oflag, (mode_t)mode, nofork); if (name == NULL) { - err_errno(IOError); + PyErr_SetFromErrno(PyExc_IOError); return NULL; } - return mkvalue("(si)", name, fildes); + return Py_BuildValue("(si)", name, fildes); } -static struct methodlist sgi_methods[] = { +static PyMethodDef sgi_methods[] = { {"nap", sgi_nap}, {"_getpty", sgi__getpty}, {NULL, NULL} /* sentinel */ @@ -89,8 +86,5 @@ static struct methodlist sgi_methods[] = { void initsgi() { - initmodule("sgi", sgi_methods); + Py_InitModule("sgi", sgi_methods); } - -int _Py_sgi_dummy; /* $%#@!& dl wants at least a byte of bss */ -/* And gcc -Wall doesn't like unused static variables :-( */ |