Skip to content

Commit

Permalink
Merge pull request #4441 from radarhere/noargs
Browse files Browse the repository at this point in the history
Use METH_NOARGS when no arguments are required
  • Loading branch information
hugovk committed Mar 2, 2020
2 parents 54b4b98 + 1dcf94a commit cd00430
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 21 deletions.
8 changes: 4 additions & 4 deletions src/_imagingft.c
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ font_render(FontObject* self, PyObject* args)
(FREETYPE_MAJOR == 2 && FREETYPE_MINOR > 9) ||\
(FREETYPE_MAJOR == 2 && FREETYPE_MINOR == 9 && FREETYPE_PATCH == 1)
static PyObject*
font_getvarnames(FontObject* self, PyObject* args)
font_getvarnames(FontObject* self)
{
int error;
FT_UInt i, j, num_namedstyles, name_count;
Expand Down Expand Up @@ -947,7 +947,7 @@ font_render(FontObject* self, PyObject* args)
}

static PyObject*
font_getvaraxes(FontObject* self, PyObject* args)
font_getvaraxes(FontObject* self)
{
int error;
FT_UInt i, j, num_axis, name_count;
Expand Down Expand Up @@ -1077,8 +1077,8 @@ static PyMethodDef font_methods[] = {
#if FREETYPE_MAJOR > 2 ||\
(FREETYPE_MAJOR == 2 && FREETYPE_MINOR > 9) ||\
(FREETYPE_MAJOR == 2 && FREETYPE_MINOR == 9 && FREETYPE_PATCH == 1)
{"getvarnames", (PyCFunction) font_getvarnames, METH_VARARGS },
{"getvaraxes", (PyCFunction) font_getvaraxes, METH_VARARGS },
{"getvarnames", (PyCFunction) font_getvarnames, METH_NOARGS },
{"getvaraxes", (PyCFunction) font_getvaraxes, METH_NOARGS },
{"setvarname", (PyCFunction) font_setvarname, METH_VARARGS},
{"setvaraxes", (PyCFunction) font_setvaraxes, METH_VARARGS},
#endif
Expand Down
27 changes: 10 additions & 17 deletions src/_webp.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ PyObject* _anim_decoder_dealloc(PyObject* self)
Py_RETURN_NONE;
}

PyObject* _anim_decoder_get_info(PyObject* self, PyObject* args)
PyObject* _anim_decoder_get_info(PyObject* self)
{
WebPAnimDecoderObject* decp = (WebPAnimDecoderObject *)self;
WebPAnimInfo* info = &(decp->info);
Expand Down Expand Up @@ -406,7 +406,7 @@ PyObject* _anim_decoder_get_chunk(PyObject* self, PyObject* args)
return ret;
}

PyObject* _anim_decoder_get_next(PyObject* self, PyObject* args)
PyObject* _anim_decoder_get_next(PyObject* self)
{
uint8_t* buf;
int timestamp;
Expand All @@ -428,13 +428,7 @@ PyObject* _anim_decoder_get_next(PyObject* self, PyObject* args)
return ret;
}

PyObject* _anim_decoder_has_more_frames(PyObject* self, PyObject* args)
{
WebPAnimDecoderObject* decp = (WebPAnimDecoderObject*)self;
return Py_BuildValue("i", WebPAnimDecoderHasMoreFrames(decp->dec));
}

PyObject* _anim_decoder_reset(PyObject* self, PyObject* args)
PyObject* _anim_decoder_reset(PyObject* self)
{
WebPAnimDecoderObject* decp = (WebPAnimDecoderObject *)self;
WebPAnimDecoderReset(decp->dec);
Expand Down Expand Up @@ -489,11 +483,10 @@ static PyTypeObject WebPAnimEncoder_Type = {

// WebPAnimDecoder methods
static struct PyMethodDef _anim_decoder_methods[] = {
{"get_info", (PyCFunction)_anim_decoder_get_info, METH_VARARGS, "get_info"},
{"get_info", (PyCFunction)_anim_decoder_get_info, METH_NOARGS, "get_info"},
{"get_chunk", (PyCFunction)_anim_decoder_get_chunk, METH_VARARGS, "get_chunk"},
{"get_next", (PyCFunction)_anim_decoder_get_next, METH_VARARGS, "get_next"},
{"has_more_frames", (PyCFunction)_anim_decoder_has_more_frames, METH_VARARGS, "has_more_frames"},
{"reset", (PyCFunction)_anim_decoder_reset, METH_VARARGS, "reset"},
{"get_next", (PyCFunction)_anim_decoder_get_next, METH_NOARGS, "get_next"},
{"reset", (PyCFunction)_anim_decoder_reset, METH_NOARGS, "reset"},
{NULL, NULL} /* sentinel */
};

Expand Down Expand Up @@ -775,7 +768,7 @@ PyObject* WebPDecode_wrapper(PyObject* self, PyObject* args)

// Return the decoder's version number, packed in hexadecimal using 8bits for
// each of major/minor/revision. E.g: v2.5.7 is 0x020507.
PyObject* WebPDecoderVersion_wrapper(PyObject* self, PyObject* args){
PyObject* WebPDecoderVersion_wrapper() {
return Py_BuildValue("i", WebPGetDecoderVersion());
}

Expand All @@ -787,7 +780,7 @@ int WebPDecoderBuggyAlpha(void) {
return WebPGetDecoderVersion()==0x0103;
}

PyObject* WebPDecoderBuggyAlpha_wrapper(PyObject* self, PyObject* args){
PyObject* WebPDecoderBuggyAlpha_wrapper() {
return Py_BuildValue("i", WebPDecoderBuggyAlpha());
}

Expand All @@ -803,8 +796,8 @@ static PyMethodDef webpMethods[] =
#endif
{"WebPEncode", WebPEncode_wrapper, METH_VARARGS, "WebPEncode"},
{"WebPDecode", WebPDecode_wrapper, METH_VARARGS, "WebPDecode"},
{"WebPDecoderVersion", WebPDecoderVersion_wrapper, METH_VARARGS, "WebPVersion"},
{"WebPDecoderBuggyAlpha", WebPDecoderBuggyAlpha_wrapper, METH_VARARGS, "WebPDecoderBuggyAlpha"},
{"WebPDecoderVersion", WebPDecoderVersion_wrapper, METH_NOARGS, "WebPVersion"},
{"WebPDecoderBuggyAlpha", WebPDecoderBuggyAlpha_wrapper, METH_NOARGS, "WebPDecoderBuggyAlpha"},
{NULL, NULL}
};

Expand Down

0 comments on commit cd00430

Please sign in to comment.