*.c: Use the new `Py_TYPE' and `Py_SIZE' macros; define them if necessary.
[catacomb-python] / share.c
diff --git a/share.c b/share.c
index 16d376e..8c58d23 100644 (file)
--- a/share.c
+++ b/share.c
@@ -61,7 +61,7 @@ static const PyGetSetDef gfshare_pygetset[]= {
   { 0 }
 };
 
-static PyTypeObject gfshare_pytype_skel = {
+static const PyTypeObject gfshare_pytype_skel = {
   PyObject_HEAD_INIT(&PyType_Type) 0,  /* Header */
   "GFShare",                           /* @tp_name@ */
   sizeof(gfshare_pyobj),               /* @tp_basicsize@ */
@@ -149,7 +149,7 @@ static const PyMethodDef gfsharesplit_pymethods[] = {
   { 0 }
 };
 
-static PyTypeObject gfsharesplit_pytype_skel = {
+static const PyTypeObject gfsharesplit_pytype_skel = {
   PyObject_HEAD_INIT(&PyType_Type) 0,  /* Header */
   "GFShareSplit",                      /* @tp_name@ */
   sizeof(gfshare_pyobj),               /* @tp_basicsize@ */
@@ -241,10 +241,9 @@ end:
   return (0);
 }
 
-static PyObject *gfsmeth_combine(PyObject *me, PyObject *arg)
+static PyObject *gfsmeth_combine(PyObject *me)
 {
   PyObject *rc = 0;
-  if (!PyArg_ParseTuple(arg, ":combine")) goto end;
   if (GFSHARE_S(me)->i < GFSHARE_S(me)->t) VALERR("not enough shares yet");
   rc = bytestring_pywrap(0, GFSHARE_S(me)->sz);
   gfshare_combine(GFSHARE_S(me), PyString_AS_STRING(rc));
@@ -256,7 +255,7 @@ static const PyMethodDef gfsharejoin_pymethods[] = {
 #define METHNAME(name) gfsmeth_##name
   METH (addedp,        "S.addedp(I) -> BOOL")
   METH (add,           "S.add(I, SHARE) -> REMAIN")
-  METH (combine,       "S.combine() -> SECRET")
+  NAMETH(combine,      "S.combine() -> SECRET")
 #undef METHNAME
   { 0 }
 };
@@ -271,7 +270,7 @@ static const PyGetSetDef gfsharejoin_pygetset[]= {
   { 0 }
 };
 
-static PyTypeObject gfsharejoin_pytype_skel = {
+static const PyTypeObject gfsharejoin_pytype_skel = {
   PyObject_HEAD_INIT(&PyType_Type) 0,  /* Header */
   "GFShareJoin",                       /* @tp_name@ */
   sizeof(gfshare_pyobj),               /* @tp_basicsize@ */
@@ -353,7 +352,7 @@ static const PyGetSetDef share_pygetset[]= {
   { 0 }
 };
 
-static PyTypeObject share_pytype_skel = {
+static const PyTypeObject share_pytype_skel = {
   PyObject_HEAD_INIT(&PyType_Type) 0,  /* Header */
   "Share",                             /* @tp_name@ */
   sizeof(share_pyobj),                 /* @tp_basicsize@ */
@@ -446,7 +445,7 @@ static const PyMethodDef sharesplit_pymethods[] = {
   { 0 }
 };
 
-static PyTypeObject sharesplit_pytype_skel = {
+static const PyTypeObject sharesplit_pytype_skel = {
   PyObject_HEAD_INIT(&PyType_Type) 0,  /* Header */
   "ShareSplit",                                /* @tp_name@ */
   sizeof(share_pyobj),                 /* @tp_basicsize@ */
@@ -541,10 +540,9 @@ end:
   return (rc);
 }
 
-static PyObject *smeth_combine(PyObject *me, PyObject *arg)
+static PyObject *smeth_combine(PyObject *me)
 {
   PyObject *rc = 0;
-  if (!PyArg_ParseTuple(arg, ":combine")) goto end;
   if (SHARE_S(me)->i < SHARE_S(me)->t) VALERR("not enough shares yet");
   rc = mp_pywrap(share_combine(SHARE_S(me)));
 end:
@@ -555,7 +553,7 @@ static const PyMethodDef sharejoin_pymethods[] = {
 #define METHNAME(name) smeth_##name
   METH (addedp,        "S.addedp(I) -> BOOL")
   METH (add,           "S.add(I, SHARE) -> REMAIN")
-  METH (combine,       "S.combine() -> SECRET")
+  NAMETH(combine,      "S.combine() -> SECRET")
 #undef METHNAME
   { 0 }
 };
@@ -570,7 +568,7 @@ static const PyGetSetDef sharejoin_pygetset[]= {
   { 0 }
 };
 
-static PyTypeObject sharejoin_pytype_skel = {
+static const PyTypeObject sharejoin_pytype_skel = {
   PyObject_HEAD_INIT(&PyType_Type) 0,  /* Header */
   "ShareJoin",                         /* @tp_name@ */
   sizeof(share_pyobj),                 /* @tp_basicsize@ */