X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb-python/blobdiff_plain/637b91402d2497db1318debd3cb3868a5abb8f01..3ed16ce3e1b50da2a4b18637d40775a52b3a2c74:/bytestring.c diff --git a/bytestring.c b/bytestring.c index 2468ea2..95da629 100644 --- a/bytestring.c +++ b/bytestring.c @@ -96,11 +96,11 @@ end: return (0); } -static PyObject *meth__ByteString_zero(PyObject *me, PyObject *arg) +static PyObject *bymeth_zero(PyObject *me, PyObject *arg) { size_t sz; PyObject *rc = 0; - if (!PyArg_ParseTuple(arg, "OO&:zero", &me, convszt, &sz)) goto end; + if (!PyArg_ParseTuple(arg, "O&:zero", convszt, &sz)) goto end; rc = bytestring_pywrap(0, sz); memset(PyString_AS_STRING(rc), 0, sz); end: @@ -265,6 +265,13 @@ BINOP(xor, ^) } UNOP(not, ~) +static const PyMethodDef bytestring_pymethods[] = { +#define METHNAME(name) bymeth_##name + SMTH (zero, "zero(N) -> 0000...00") +#undef METHNAME + { 0 } +}; + static const PyNumberMethods bytestring_pynumber = { 0, /* @nb_add@ */ 0, /* @nb_subtract@ */ @@ -344,7 +351,7 @@ static PyTypeObject bytestring_pytype_skel = { 0, /* @tp_weaklistoffset@ */ 0, /* @tp_iter@ */ 0, /* @tp_iternext@ */ - 0, /* @tp_methods@ */ + PYMETHODS(bytestring), /* @tp_methods@ */ 0, /* @tp_members@ */ 0, /* @tp_getset@ */ 0, /* @tp_base@ */ @@ -364,7 +371,6 @@ static PyTypeObject bytestring_pytype_skel = { static const PyMethodDef methods[] = { #define METHNAME(func) meth_##func METH (ctstreq, "ctstreq(S, T) -> BOOL") - METH (_ByteString_zero, "zero(N) -> 0000...00") #undef METHNAME { 0 } };