diff options
Diffstat (limited to 'Modules/fmmodule.c')
-rw-r--r-- | Modules/fmmodule.c | 50 |
1 files changed, 18 insertions, 32 deletions
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 */ }; |