summaryrefslogtreecommitdiffstats
path: root/Modules/shamodule.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-05-29 21:04:52 (GMT)
committerGeorg Brandl <georg@python.org>2006-05-29 21:04:52 (GMT)
commit96a8c3954cbdb186bc567a490dad8987508ce268 (patch)
tree4d6516790abcd566c43418e4c9b02e9c52cf9f2f /Modules/shamodule.c
parentfd9a4b19e9c77e9ccc3e7fcb57051cf160c0df6d (diff)
downloadcpython-96a8c3954cbdb186bc567a490dad8987508ce268.zip
cpython-96a8c3954cbdb186bc567a490dad8987508ce268.tar.gz
cpython-96a8c3954cbdb186bc567a490dad8987508ce268.tar.bz2
Make use of METH_O and METH_NOARGS where possible.
Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.
Diffstat (limited to 'Modules/shamodule.c')
-rw-r--r--Modules/shamodule.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/Modules/shamodule.c b/Modules/shamodule.c
index 058391d..8d68d16 100644
--- a/Modules/shamodule.c
+++ b/Modules/shamodule.c
@@ -358,13 +358,10 @@ SHA_dealloc(PyObject *ptr)
PyDoc_STRVAR(SHA_copy__doc__, "Return a copy of the hashing object.");
static PyObject *
-SHA_copy(SHAobject *self, PyObject *args)
+SHA_copy(SHAobject *self, PyObject *unused)
{
SHAobject *newobj;
- if (!PyArg_ParseTuple(args, ":copy")) {
- return NULL;
- }
if ( (newobj = newSHAobject())==NULL)
return NULL;
@@ -376,14 +373,11 @@ PyDoc_STRVAR(SHA_digest__doc__,
"Return the digest value as a string of binary data.");
static PyObject *
-SHA_digest(SHAobject *self, PyObject *args)
+SHA_digest(SHAobject *self, PyObject *unused)
{
unsigned char digest[SHA_DIGESTSIZE];
SHAobject temp;
- if (!PyArg_ParseTuple(args, ":digest"))
- return NULL;
-
SHAcopy(self, &temp);
sha_final(digest, &temp);
return PyString_FromStringAndSize((const char *)digest, sizeof(digest));
@@ -393,7 +387,7 @@ PyDoc_STRVAR(SHA_hexdigest__doc__,
"Return the digest value as a string of hexadecimal digits.");
static PyObject *
-SHA_hexdigest(SHAobject *self, PyObject *args)
+SHA_hexdigest(SHAobject *self, PyObject *unused)
{
unsigned char digest[SHA_DIGESTSIZE];
SHAobject temp;
@@ -401,9 +395,6 @@ SHA_hexdigest(SHAobject *self, PyObject *args)
char *hex_digest;
int i, j;
- if (!PyArg_ParseTuple(args, ":hexdigest"))
- return NULL;
-
/* Get the raw (binary) digest value */
SHAcopy(self, &temp);
sha_final(digest, &temp);
@@ -450,9 +441,9 @@ SHA_update(SHAobject *self, PyObject *args)
}
static PyMethodDef SHA_methods[] = {
- {"copy", (PyCFunction)SHA_copy, METH_VARARGS, SHA_copy__doc__},
- {"digest", (PyCFunction)SHA_digest, METH_VARARGS, SHA_digest__doc__},
- {"hexdigest", (PyCFunction)SHA_hexdigest, METH_VARARGS, SHA_hexdigest__doc__},
+ {"copy", (PyCFunction)SHA_copy, METH_NOARGS, SHA_copy__doc__},
+ {"digest", (PyCFunction)SHA_digest, METH_NOARGS, SHA_digest__doc__},
+ {"hexdigest", (PyCFunction)SHA_hexdigest, METH_NOARGS, SHA_hexdigest__doc__},
{"update", (PyCFunction)SHA_update, METH_VARARGS, SHA_update__doc__},
{NULL, NULL} /* sentinel */
};