diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2002-03-31 15:27:00 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2002-03-31 15:27:00 (GMT) |
commit | ba3a16c6c3d3da0903873e9464dbc540eaeda1f7 (patch) | |
tree | 6094d419dcf56dfdb9bdb50da0a15d0c0160573a /Modules/sunaudiodev.c | |
parent | 50905b557b2a46d4db432b7a9e61fe32afa557e3 (diff) | |
download | cpython-ba3a16c6c3d3da0903873e9464dbc540eaeda1f7.zip cpython-ba3a16c6c3d3da0903873e9464dbc540eaeda1f7.tar.gz cpython-ba3a16c6c3d3da0903873e9464dbc540eaeda1f7.tar.bz2 |
Remove METH_OLDARGS:
Convert METH_OLDARGS -> METH_VARARGS: also PyArg_Parse -> PyArg_ParseTuple
Convert METH_OLDARGS -> METH_NOARGS: remove args parameter
Please review. All tests pass, but some modules don't have tests.
I spot checked various functions to try to make sure nothing broke.
Diffstat (limited to 'Modules/sunaudiodev.c')
-rw-r--r-- | Modules/sunaudiodev.c | 65 |
1 files changed, 23 insertions, 42 deletions
diff --git a/Modules/sunaudiodev.c b/Modules/sunaudiodev.c index 514cab6..506ee33 100644 --- a/Modules/sunaudiodev.c +++ b/Modules/sunaudiodev.c @@ -58,7 +58,7 @@ newsadobject(PyObject *args) char* opendev; /* Check arg for r/w/rw */ - if (!PyArg_Parse(args, "s", &mode)) + if (!PyArg_ParseTuple(args, "s", &mode)) return NULL; if (strcmp(mode, "r") == 0) imode = 0; @@ -133,7 +133,7 @@ sad_read(sadobject *self, PyObject *args) char *cp; PyObject *rv; - if (!PyArg_Parse(args, "i", &size)) + if (!PyArg_ParseTuple(args, "i:read", &size)) return NULL; rv = PyString_FromStringAndSize(NULL, size); if (rv == NULL) @@ -169,7 +169,7 @@ sad_write(sadobject *self, PyObject *args) char *cp; int count, size; - if (!PyArg_Parse(args, "s#", &cp, &size)) + if (!PyArg_ParseTuple(args, "s#:write", &cp, &size)) return NULL; count = write(self->x_fd, cp, size); @@ -188,12 +188,10 @@ sad_write(sadobject *self, PyObject *args) } static PyObject * -sad_getinfo(sadobject *self, PyObject *args) +sad_getinfo(sadobject *self) { sadstatusobject *rv; - if (!PyArg_Parse(args, "")) - return NULL; if (!(rv = sads_alloc())) return NULL; @@ -222,12 +220,10 @@ sad_setinfo(sadobject *self, sadstatusobject *arg) } static PyObject * -sad_ibufcount(sadobject *self, PyObject *args) +sad_ibufcount(sadobject *self) { audio_info_t ai; - if (!PyArg_Parse(args, "")) - return NULL; if (ioctl(self->x_fd, AUDIO_GETINFO, &ai) < 0) { PyErr_SetFromErrno(SunAudioError); return NULL; @@ -236,12 +232,10 @@ sad_ibufcount(sadobject *self, PyObject *args) } static PyObject * -sad_obufcount(sadobject *self, PyObject *args) +sad_obufcount(sadobject *self) { audio_info_t ai; - if (!PyArg_Parse(args, "")) - return NULL; if (ioctl(self->x_fd, AUDIO_GETINFO, &ai) < 0) { PyErr_SetFromErrno(SunAudioError); return NULL; @@ -254,11 +248,8 @@ sad_obufcount(sadobject *self, PyObject *args) } static PyObject * -sad_drain(sadobject *self, PyObject *args) +sad_drain(sadobject *self) { - - if (!PyArg_Parse(args, "")) - return NULL; if (ioctl(self->x_fd, AUDIO_DRAIN, 0) < 0) { PyErr_SetFromErrno(SunAudioError); return NULL; @@ -269,12 +260,10 @@ sad_drain(sadobject *self, PyObject *args) #ifdef SOLARIS static PyObject * -sad_getdev(sadobject *self, PyObject *args) +sad_getdev(sadobject *self) { struct audio_device ad; - if (!PyArg_Parse(args, "")) - return NULL; if (ioctl(self->x_fd, AUDIO_GETDEV, &ad) < 0) { PyErr_SetFromErrno(SunAudioError); return NULL; @@ -284,11 +273,8 @@ sad_getdev(sadobject *self, PyObject *args) #endif static PyObject * -sad_flush(sadobject *self, PyObject *args) +sad_flush(sadobject *self) { - - if (!PyArg_Parse(args, "")) - return NULL; if (ioctl(self->x_fd, I_FLUSH, FLUSHW) < 0) { PyErr_SetFromErrno(SunAudioError); return NULL; @@ -298,11 +284,9 @@ sad_flush(sadobject *self, PyObject *args) } static PyObject * -sad_close(sadobject *self, PyObject *args) +sad_close(sadobject *self) { - if (!PyArg_Parse(args, "")) - return NULL; if (self->x_fd >= 0) { close(self->x_fd); self->x_fd = -1; @@ -312,30 +296,27 @@ sad_close(sadobject *self, PyObject *args) } static PyObject * -sad_fileno(sadobject *self, PyObject *args) +sad_fileno(sadobject *self) { - if (!PyArg_Parse(args, "")) - return NULL; - return PyInt_FromLong(self->x_fd); } static PyMethodDef sad_methods[] = { - { "read", (PyCFunction)sad_read, METH_OLDARGS }, - { "write", (PyCFunction)sad_write, METH_OLDARGS }, - { "ibufcount", (PyCFunction)sad_ibufcount, METH_OLDARGS }, - { "obufcount", (PyCFunction)sad_obufcount, METH_OLDARGS }, + { "read", (PyCFunction)sad_read, METH_VARARGS }, + { "write", (PyCFunction)sad_write, METH_VARARGS }, + { "ibufcount", (PyCFunction)sad_ibufcount, METH_NOARGS }, + { "obufcount", (PyCFunction)sad_obufcount, METH_NOARGS }, #define CTL_METHODS 4 - { "getinfo", (PyCFunction)sad_getinfo, METH_OLDARGS }, - { "setinfo", (PyCFunction)sad_setinfo, METH_OLDARGS }, - { "drain", (PyCFunction)sad_drain, METH_OLDARGS }, - { "flush", (PyCFunction)sad_flush, METH_OLDARGS }, + { "getinfo", (PyCFunction)sad_getinfo, METH_NOARGS }, + { "setinfo", (PyCFunction)sad_setinfo, METH_O}, + { "drain", (PyCFunction)sad_drain, METH_NOARGS }, + { "flush", (PyCFunction)sad_flush, METH_NOARGS }, #ifdef SOLARIS - { "getdev", (PyCFunction)sad_getdev, METH_OLDARGS }, + { "getdev", (PyCFunction)sad_getdev, METH_NOARGS }, #endif - { "close", (PyCFunction)sad_close, METH_OLDARGS }, - { "fileno", (PyCFunction)sad_fileno, METH_OLDARGS }, + { "close", (PyCFunction)sad_close, METH_NOARGS }, + { "fileno", (PyCFunction)sad_fileno, METH_NOARGS }, {NULL, NULL} /* sentinel */ }; @@ -465,7 +446,7 @@ sadopen(PyObject *self, PyObject *args) } static PyMethodDef sunaudiodev_methods[] = { - { "open", sadopen, METH_OLDARGS }, + { "open", sadopen, METH_VARARGS }, { 0, 0 }, }; |