*.c: Make all of the type-definition tables read-only.
[catacomb-python] / buffer.c
index 43ed43d..49ed9d2 100644 (file)
--- a/buffer.c
+++ b/buffer.c
@@ -245,7 +245,7 @@ end:
   return (-1);
 }
 
-static PyGetSetDef rbuf_pygetset[] = {
+static const PyGetSetDef rbuf_pygetset[] = {
 #define GETSETNAME(op, name) rb##op##_##name
   GET  (size,          "RBUF.size -> SIZE")
   GET  (left,          "RBUF.left -> REMAINDER")
@@ -255,7 +255,7 @@ static PyGetSetDef rbuf_pygetset[] = {
   { 0 }
 };
 
-static PyMethodDef rbuf_pymethods[] = {
+static const PyMethodDef rbuf_pymethods[] = {
 #define METHNAME(func) rbmeth_##func
   METH (skip,          "RBUF.skip(N)")
   METH (get,           "RBUF.get(N) -> BYTES")
@@ -278,7 +278,7 @@ static PyMethodDef rbuf_pymethods[] = {
   { 0 }
 };
 
-static PyBufferProcs rbuf_pybuffer = {
+static const PyBufferProcs rbuf_pybuffer = {
   rbuf_pyreadbuf,                      /* @bf_getreadbuffer@ */
   0,                                   /* @bf_getwritebuffer@ */
   rbuf_pysegcount,                     /* @bf_getsegcount@ */
@@ -305,7 +305,7 @@ static PyTypeObject rbuf_pytype_skel = {
   0,                                   /* @tp_str@ */
   0,                                   /* @tp_getattro@ */
   0,                                   /* @tp_setattro@ */
-  &rbuf_pybuffer,                      /* @tp_as_buffer@ */
+  PYBUFFER(rbuf),                      /* @tp_as_buffer@ */
   Py_TPFLAGS_DEFAULT |                 /* @tp_flags@ */
     Py_TPFLAGS_BASETYPE,
 
@@ -318,9 +318,9 @@ static PyTypeObject rbuf_pytype_skel = {
   0,                                   /* @tp_weaklistoffset@ */
   0,                                   /* @tp_iter@ */
   0,                                   /* @tp_iternext@ */
-  rbuf_pymethods,                      /* @tp_methods@ */
+  PYMETHODS(rbuf),                     /* @tp_methods@ */
   0,                                   /* @tp_members@ */
-  rbuf_pygetset,                       /* @tp_getset@ */
+  PYGETSET(rbuf),                      /* @tp_getset@ */
   0,                                   /* @tp_base@ */
   0,                                   /* @tp_dict@ */
   0,                                   /* @tp_descr_get@ */
@@ -490,7 +490,7 @@ static PyObject *wbget_size(PyObject *me, void *hunoz)
 static PyObject *wbget_contents(PyObject *me, void *hunoz)
   { return (bytestring_pywrap(BBASE(BUF_B(me)), BLEN(BUF_B(me)))); }
 
-static PyGetSetDef wbuf_pygetset[] = {
+static const PyGetSetDef wbuf_pygetset[] = {
 #define GETSETNAME(op, name) wb##op##_##name
   GET  (size,          "WBUF.size -> SIZE")
   GET  (contents,      "WBUF.contents -> STR")
@@ -498,7 +498,7 @@ static PyGetSetDef wbuf_pygetset[] = {
   { 0 }
 };
 
-static PyMethodDef wbuf_pymethods[] = {
+static const PyMethodDef wbuf_pymethods[] = {
 #define METHNAME(func) wbmeth_##func
   METH (zero,          "WBUF.zero(N)")
   METH (put,           "WBUF.put(BYTES)")
@@ -518,7 +518,7 @@ static PyMethodDef wbuf_pymethods[] = {
   { 0 }
 };
 
-static PyBufferProcs wbuf_pybuffer = {
+static const PyBufferProcs wbuf_pybuffer = {
   wbuf_pyreadbuf,                      /* @bf_getreadbuffer@ */
   0,                                   /* @bf_getwritebuffer@ */
   wbuf_pysegcount,                     /* @bf_getsegcount@ */
@@ -545,7 +545,7 @@ static PyTypeObject wbuf_pytype_skel = {
   0,                                   /* @tp_str@ */
   0,                                   /* @tp_getattro@ */
   0,                                   /* @tp_setattro@ */
-  &wbuf_pybuffer,                      /* @tp_as_buffer@ */
+  PYBUFFER(wbuf),                      /* @tp_as_buffer@ */
   Py_TPFLAGS_DEFAULT |                 /* @tp_flags@ */
     Py_TPFLAGS_BASETYPE,
 
@@ -558,9 +558,9 @@ static PyTypeObject wbuf_pytype_skel = {
   0,                                   /* @tp_weaklistoffset@ */
   0,                                   /* @tp_iter@ */
   0,                                   /* @tp_iternext@ */
-  wbuf_pymethods,                      /* @tp_methods@ */
+  PYMETHODS(wbuf),                     /* @tp_methods@ */
   0,                                   /* @tp_members@ */
-  wbuf_pygetset,                       /* @tp_getset@ */
+  PYGETSET(wbuf),                      /* @tp_getset@ */
   0,                                   /* @tp_base@ */
   0,                                   /* @tp_dict@ */
   0,                                   /* @tp_descr_get@ */