Shuffle code so it compiles with MSVC too. (Array of unknown size otherwise).
authorNathan Letwory <nathan@letworyinteractive.com>
Thu, 14 Jul 2011 08:20:19 +0000 (08:20 +0000)
committerNathan Letwory <nathan@letworyinteractive.com>
Thu, 14 Jul 2011 08:20:19 +0000 (08:20 +0000)
source/blender/python/generic/bgl.c

index 1891e13fdc168f77aa351ad90e6ab55f9593720c..18d01f450150a73fda06f59eb5e5b845e7c2d9de 100644 (file)
@@ -69,11 +69,44 @@ static PySequenceMethods Buffer_SeqMethods = {
 };
 
 static void Buffer_dealloc(PyObject *self);
-static PyObject *Buffer_tolist(PyObject *self, void *arg);
-static PyObject *Buffer_dimensions(PyObject *self, void *arg);
 static PyObject *Buffer_repr(PyObject *self);
-static PyMethodDef Buffer_methods[];
-static PyGetSetDef Buffer_getseters[];
+
+static PyObject *Buffer_to_list(PyObject *self)
+{
+       int i, len= ((Buffer *)self)->dimensions[0];
+       PyObject *list= PyList_New(len);
+
+       for (i=0; i<len; i++) {
+               PyList_SET_ITEM(list, i, Buffer_item(self, i));
+       }
+
+       return list;
+}
+
+static PyObject *Buffer_dimensions(PyObject *self, void *UNUSED(arg))
+{
+       Buffer *buffer= (Buffer *) self;
+       PyObject *list= PyList_New(buffer->ndimensions);
+       int i;
+
+       for (i= 0; i<buffer->ndimensions; i++) {
+               PyList_SET_ITEM(list, i, PyLong_FromLong(buffer->dimensions[i]));
+       }
+
+       return list;
+}
+
+static PyMethodDef Buffer_methods[] = {
+       {"to_list", (PyCFunction)Buffer_to_list, METH_NOARGS,
+     "return the buffer as a list"},
+       {NULL, NULL, 0, NULL}
+};
+
+static PyGetSetDef Buffer_getseters[] = {
+       {(char *)"dimensions", (getter)Buffer_dimensions, NULL, NULL, NULL},
+        {NULL, NULL, NULL, NULL, NULL}
+};
+
 
 PyTypeObject BGL_bufferType = {
        PyVarObject_HEAD_INIT(NULL, 0)
@@ -460,41 +493,6 @@ static void Buffer_dealloc(PyObject *self)
        PyObject_DEL(self);
 }
 
-static PyObject *Buffer_to_list(PyObject *self)
-{
-       int i, len= ((Buffer *)self)->dimensions[0];
-       PyObject *list= PyList_New(len);
-
-       for (i=0; i<len; i++) {
-               PyList_SET_ITEM(list, i, Buffer_item(self, i));
-       }
-
-       return list;
-}
-
-static PyObject *Buffer_dimensions(PyObject *self, void *UNUSED(arg))
-{
-       Buffer *buffer= (Buffer *) self;
-       PyObject *list= PyList_New(buffer->ndimensions);
-       int i;
-
-       for (i= 0; i<buffer->ndimensions; i++) {
-               PyList_SET_ITEM(list, i, PyLong_FromLong(buffer->dimensions[i]));
-       }
-
-       return list;
-}
-
-static PyMethodDef Buffer_methods[] = {
-       {"to_list", (PyCFunction)Buffer_to_list, METH_NOARGS,
-     "return the buffer as a list"},
-       {NULL, NULL, 0, NULL}
-};
-
-static PyGetSetDef Buffer_getseters[] = {
-       {(char *)"dimensions", (getter)Buffer_dimensions, NULL, NULL, NULL},
-        {NULL, NULL, NULL, NULL, NULL}
-};
 
 static PyObject *Buffer_repr(PyObject *self)
 {