summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2002-03-31 14:57:24 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2002-03-31 14:57:24 (GMT)
commit50905b557b2a46d4db432b7a9e61fe32afa557e3 (patch)
treeb86e16799cb58028893b510d0ebafa24eeecfaf8 /Modules
parent01b2694acb99e3164b8d65469ee54feb68a7cd08 (diff)
downloadcpython-50905b557b2a46d4db432b7a9e61fe32afa557e3.zip
cpython-50905b557b2a46d4db432b7a9e61fe32afa557e3.tar.gz
cpython-50905b557b2a46d4db432b7a9e61fe32afa557e3.tar.bz2
Convert from using METH_OLDARGS to METH_NOARGS.
These should be safe.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/clmodule.c40
-rw-r--r--Modules/fmmodule.c50
-rw-r--r--Modules/timingmodule.c39
3 files changed, 44 insertions, 85 deletions
diff --git a/Modules/clmodule.c b/Modules/clmodule.c
index 65e7f78..c8526c4 100644
--- a/Modules/clmodule.c
+++ b/Modules/clmodule.c
@@ -183,13 +183,10 @@ cl_DecompressImage(PyObject *self, PyObject *args)
}
static PyObject *
-doClose(clobject *self, PyObject *args, int (*close_func)(CL_Handle))
+doClose(clobject *self, int (*close_func)(CL_Handle))
{
CheckCompressor(self);
- if (!PyArg_NoArgs(args))
- return NULL;
-
error_handler_called = 0;
if ((*close_func)(self->ob_compressorHdl) == FAILURE ||
error_handler_called) {
@@ -209,15 +206,15 @@ doClose(clobject *self, PyObject *args, int (*close_func)(CL_Handle))
}
static PyObject *
-clm_CloseCompressor(PyObject *self, PyObject *args)
+clm_CloseCompressor(PyObject *self)
{
- return doClose(SELF, args, clCloseCompressor);
+ return doClose(SELF, clCloseCompressor);
}
static PyObject *
-clm_CloseDecompressor(PyObject *self, PyObject *args)
+clm_CloseDecompressor(PyObject *self)
{
- return doClose(SELF, args, clCloseDecompressor);
+ return doClose(SELF, clCloseDecompressor);
}
static PyObject *
@@ -479,7 +476,7 @@ clm_GetParamID(PyObject *self, PyObject *args)
}
static PyObject *
-clm_QueryParams(PyObject *self, PyObject *args)
+clm_QueryParams(PyObject *self)
{
int bufferlength;
int *PVbuffer;
@@ -488,9 +485,6 @@ clm_QueryParams(PyObject *self, PyObject *args)
CheckCompressor(SELF);
- if (!PyArg_NoArgs(args))
- return NULL;
-
error_handler_called = 0;
bufferlength = clQueryParams(SELF->ob_compressorHdl, 0, 0);
if (error_handler_called)
@@ -574,13 +568,9 @@ clm_GetName(PyObject *self, PyObject *args)
}
static PyObject *
-clm_QuerySchemeFromHandle(PyObject *self, PyObject *args)
+clm_QuerySchemeFromHandle(PyObject *self)
{
CheckCompressor(SELF);
-
- if (!PyArg_NoArgs(args))
- return NULL;
-
return PyInt_FromLong(clQuerySchemeFromHandle(SELF->ob_compressorHdl));
}
@@ -600,8 +590,8 @@ clm_ReadHeader(PyObject *self, PyObject *args)
}
static PyMethodDef compressor_methods[] = {
- {"close", clm_CloseCompressor, METH_OLDARGS}, /* alias */
- {"CloseCompressor", clm_CloseCompressor, METH_OLDARGS},
+ {"close", clm_CloseCompressor, METH_NOARGS}, /* alias */
+ {"CloseCompressor", clm_CloseCompressor, METH_NOARGS},
{"Compress", clm_Compress, METH_OLDARGS},
{"GetDefault", clm_GetDefault, METH_OLDARGS},
{"GetMinMax", clm_GetMinMax, METH_OLDARGS},
@@ -609,16 +599,16 @@ static PyMethodDef compressor_methods[] = {
{"GetParam", clm_GetParam, METH_OLDARGS},
{"GetParamID", clm_GetParamID, METH_OLDARGS},
{"GetParams", clm_GetParams, METH_OLDARGS},
- {"QueryParams", clm_QueryParams, METH_OLDARGS},
- {"QuerySchemeFromHandle",clm_QuerySchemeFromHandle, METH_OLDARGS},
+ {"QueryParams", clm_QueryParams, METH_NOARGS},
+ {"QuerySchemeFromHandle",clm_QuerySchemeFromHandle, METH_NOARGS},
{"SetParam", clm_SetParam, METH_OLDARGS},
{"SetParams", clm_SetParams, METH_OLDARGS},
{NULL, NULL} /* sentinel */
};
static PyMethodDef decompressor_methods[] = {
- {"close", clm_CloseDecompressor, METH_OLDARGS}, /* alias */
- {"CloseDecompressor", clm_CloseDecompressor, METH_OLDARGS},
+ {"close", clm_CloseDecompressor, METH_NOARGS}, /* alias */
+ {"CloseDecompressor", clm_CloseDecompressor, METH_NOARGS},
{"Decompress", clm_Decompress, METH_OLDARGS},
{"GetDefault", clm_GetDefault, METH_OLDARGS},
{"GetMinMax", clm_GetMinMax, METH_OLDARGS},
@@ -627,8 +617,8 @@ static PyMethodDef decompressor_methods[] = {
{"GetParamID", clm_GetParamID, METH_OLDARGS},
{"GetParams", clm_GetParams, METH_OLDARGS},
{"ReadHeader", clm_ReadHeader, METH_OLDARGS},
- {"QueryParams", clm_QueryParams, METH_OLDARGS},
- {"QuerySchemeFromHandle",clm_QuerySchemeFromHandle, METH_OLDARGS},
+ {"QueryParams", clm_QueryParams, METH_NOARGS},
+ {"QuerySchemeFromHandle",clm_QuerySchemeFromHandle, METH_NOARGS},
{"SetParam", clm_SetParam, METH_OLDARGS},
{"SetParams", clm_SetParams, METH_OLDARGS},
{NULL, NULL} /* sentinel */
diff --git a/Modules/fmmodule.c b/Modules/fmmodule.c
index ecd96d5..d6d753a 100644
--- a/Modules/fmmodule.c
+++ b/Modules/fmmodule.c
@@ -49,22 +49,18 @@ fh_scalefont(fhobject *self, PyObject *args)
/* XXX fmmakefont */
static PyObject *
-fh_setfont(fhobject *self, PyObject *args)
+fh_setfont(fhobject *self)
{
- if (!PyArg_NoArgs(args))
- return NULL;
fmsetfont(self->fh_fh);
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *
-fh_getfontname(fhobject *self, PyObject *args)
+fh_getfontname(fhobject *self)
{
char fontname[256];
int len;
- if (!PyArg_NoArgs(args))
- return NULL;
len = fmgetfontname(self->fh_fh, sizeof fontname, fontname);
if (len < 0) {
PyErr_SetString(PyExc_RuntimeError, "error in fmgetfontname");
@@ -74,12 +70,10 @@ fh_getfontname(fhobject *self, PyObject *args)
}
static PyObject *
-fh_getcomment(fhobject *self, PyObject *args)
+fh_getcomment(fhobject *self)
{
char comment[256];
int len;
- if (!PyArg_NoArgs(args))
- return NULL;
len = fmgetcomment(self->fh_fh, sizeof comment, comment);
if (len < 0) {
PyErr_SetString(PyExc_RuntimeError, "error in fmgetcomment");
@@ -89,11 +83,9 @@ fh_getcomment(fhobject *self, PyObject *args)
}
static PyObject *
-fh_getfontinfo(fhobject *self, PyObject *args)
+fh_getfontinfo(fhobject *self)
{
fmfontinfo info;
- if (!PyArg_NoArgs(args))
- return NULL;
if (fmgetfontinfo(self->fh_fh, &info) < 0) {
PyErr_SetString(PyExc_RuntimeError, "error in fmgetfontinfo");
return NULL;
@@ -126,11 +118,11 @@ fh_getstrwidth(fhobject *self, PyObject *args)
}
static PyMethodDef fh_methods[] = {
- {"scalefont", (PyCFunction)fh_scalefont, METH_OLDARGS},
- {"setfont", (PyCFunction)fh_setfont, METH_OLDARGS},
- {"getfontname", (PyCFunction)fh_getfontname, METH_OLDARGS},
- {"getcomment", (PyCFunction)fh_getcomment, METH_OLDARGS},
- {"getfontinfo", (PyCFunction)fh_getfontinfo, METH_OLDARGS},
+ {"scalefont", (PyCFunction)fh_scalefont, METH_OLDARGS},
+ {"setfont", (PyCFunction)fh_setfont, METH_NOARGS},
+ {"getfontname", (PyCFunction)fh_getfontname, METH_NOARGS},
+ {"getcomment", (PyCFunction)fh_getcomment, METH_NOARGS},
+ {"getfontinfo", (PyCFunction)fh_getfontinfo, METH_NOARGS},
#if 0
{"getwholemetrics", (PyCFunction)fh_getwholemetrics, METH_OLDARGS},
#endif
@@ -170,10 +162,8 @@ static PyTypeObject Fhtype = {
/* Font Manager functions */
static PyObject *
-fm_init(PyObject *self, PyObject *args)
+fm_init(PyObject *self)
{
- if (!PyArg_NoArgs(args))
- return NULL;
fminit();
Py_INCREF(Py_None);
return Py_None;
@@ -224,11 +214,9 @@ clientproc(char *fontname)
}
static PyObject *
-fm_enumerate(PyObject *self, PyObject *args)
+fm_enumerate(PyObject *self)
{
PyObject *res;
- if (!PyArg_NoArgs(args))
- return NULL;
fontlist = PyList_New(0);
if (fontlist == NULL)
return NULL;
@@ -250,20 +238,18 @@ fm_setpath(PyObject *self, PyObject *args)
}
static PyObject *
-fm_fontpath(PyObject *self, PyObject *args)
+fm_fontpath(PyObject *self)
{
- if (!PyArg_NoArgs(args))
- return NULL;
return PyString_FromString(fmfontpath());
}
static PyMethodDef fm_methods[] = {
- {"init", fm_init, METH_OLDARGS},
- {"findfont", fm_findfont, METH_OLDARGS},
- {"enumerate", fm_enumerate, METH_OLDARGS},
- {"prstr", fm_prstr, METH_OLDARGS},
- {"setpath", fm_setpath, METH_OLDARGS},
- {"fontpath", fm_fontpath, METH_OLDARGS},
+ {"init", fm_init, METH_NOARGS},
+ {"findfont", fm_findfont, METH_OLDARGS},
+ {"enumerate", fm_enumerate, METH_NOARGS},
+ {"prstr", fm_prstr, METH_OLDARGS},
+ {"setpath", fm_setpath, METH_OLDARGS},
+ {"fontpath", fm_fontpath, METH_NOARGS},
{NULL, NULL} /* sentinel */
};
diff --git a/Modules/timingmodule.c b/Modules/timingmodule.c
index 4f1d5cf..4e10e31 100644
--- a/Modules/timingmodule.c
+++ b/Modules/timingmodule.c
@@ -8,63 +8,46 @@
#include "timing.h"
static PyObject *
-start_timing(PyObject *self, PyObject *args)
+start_timing(PyObject *self)
{
- if (!PyArg_Parse(args, ""))
- return NULL;
-
Py_INCREF(Py_None);
BEGINTIMING;
return Py_None;
}
static PyObject *
-finish_timing(PyObject *self, PyObject *args)
+finish_timing(PyObject *self)
{
- if (!PyArg_Parse(args, ""))
- return NULL;
-
ENDTIMING
Py_INCREF(Py_None);
return Py_None;
}
static PyObject *
-seconds(PyObject *self, PyObject *args)
+seconds(PyObject *self)
{
- if (!PyArg_Parse(args, ""))
- return NULL;
-
return PyInt_FromLong(TIMINGS);
-
}
static PyObject *
-milli(PyObject *self, PyObject *args)
+milli(PyObject *self)
{
- if (!PyArg_Parse(args, ""))
- return NULL;
-
return PyInt_FromLong(TIMINGMS);
-
}
+
static PyObject *
-micro(PyObject *self, PyObject *args)
+micro(PyObject *self)
{
- if (!PyArg_Parse(args, ""))
- return NULL;
-
return PyInt_FromLong(TIMINGUS);
-
}
static PyMethodDef timing_methods[] = {
- {"start", start_timing, METH_OLDARGS},
- {"finish", finish_timing, METH_OLDARGS},
- {"seconds", seconds, METH_OLDARGS},
- {"milli", milli, METH_OLDARGS},
- {"micro", micro, METH_OLDARGS},
+ {"start", (PyCFunction)start_timing, METH_NOARGS},
+ {"finish", (PyCFunction)finish_timing, METH_NOARGS},
+ {"seconds", (PyCFunction)seconds, METH_NOARGS},
+ {"milli", (PyCFunction)milli, METH_NOARGS},
+ {"micro", (PyCFunction)micro, METH_NOARGS},
{NULL, NULL}
};