Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-09-07 03:46:20 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-09-07 03:46:20 +0400
commit9161d3ce4bdd7c838751462b47eb045ea33a686e (patch)
tree8ce7ec347331f641b7fb53647b66a102235cd2bc /source/blender/python
parent9baff83d72ccb287e2e6011c648877b96790e9a9 (diff)
use Py_ssize_t rather than int when dealing with list sizes (original patch from Fedora but applied changes elsewhere too), also replace PyList_Size with PyList_GET_SIZE where typechecking is already done.
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/generic/bpy_internal_import.c4
-rw-r--r--source/blender/python/intern/bpy_rna.c2
-rw-r--r--source/blender/python/mathutils/mathutils_geometry.c12
3 files changed, 9 insertions, 9 deletions
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index f0158fe72c3..67ed90c79eb 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -344,7 +344,7 @@ void bpy_text_clear_modules(int clear_all)
/* looping over the dict */
PyObject *key, *value;
- int pos= 0;
+ Py_ssize_t pos= 0;
/* new list */
PyObject *list;
@@ -374,7 +374,7 @@ void bpy_text_clear_modules(int clear_all)
}
/* remove all our modules */
- for(pos=0; pos < PyList_Size(list); pos++) {
+ for(pos=0; pos < PyList_GET_SIZE(list); pos++) {
/* PyObject_Print(key, stderr, 0); */
key= PyList_GET_ITEM(list, pos);
PyDict_DelItem(modules, key);
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index d10c8c843e8..2212499d842 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -4608,7 +4608,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
#ifdef DEBUG_STRING_FREE
- // if(PyList_Size(string_free_ls)) printf("%.200s.%.200s(): has %d strings\n", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), (int)PyList_Size(string_free_ls));
+ // if(PyList_GET_SIZE(string_free_ls)) printf("%.200s.%.200s(): has %d strings\n", RNA_struct_identifier(self_ptr->type), RNA_function_identifier(self_func), (int)PyList_GET_SIZE(string_free_ls));
Py_DECREF(string_free_ls);
#undef DEBUG_STRING_FREE
#endif
diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c
index bcdfe020e1a..0394d732ae3 100644
--- a/source/blender/python/mathutils/mathutils_geometry.c
+++ b/source/blender/python/mathutils/mathutils_geometry.c
@@ -983,7 +983,7 @@ static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *
static int boxPack_FromPyObject(PyObject *value, boxPack **boxarray)
{
- int len, i;
+ Py_ssize_t len, i;
PyObject *list_item, *item_1, *item_2;
boxPack *box;
@@ -995,14 +995,14 @@ static int boxPack_FromPyObject(PyObject *value, boxPack **boxarray)
return -1;
}
- len= PyList_Size(value);
+ len= PyList_GET_SIZE(value);
(*boxarray)= MEM_mallocN(len*sizeof(boxPack), "boxPack box");
for(i= 0; i < len; i++) {
list_item= PyList_GET_ITEM(value, i);
- if(!PyList_Check(list_item) || PyList_Size(list_item) < 4) {
+ if(!PyList_Check(list_item) || PyList_GET_SIZE(list_item) < 4) {
MEM_freeN(*boxarray);
PyErr_SetString(PyExc_TypeError,
"can only pack a list of [x, y, w, h]");
@@ -1034,11 +1034,11 @@ static int boxPack_FromPyObject(PyObject *value, boxPack **boxarray)
static void boxPack_ToPyObject(PyObject *value, boxPack **boxarray)
{
- int len, i;
+ Py_ssize_t len, i;
PyObject *list_item;
boxPack *box;
- len= PyList_Size(value);
+ len= PyList_GET_SIZE(value);
for(i= 0; i < len; i++) {
box= (*boxarray)+i;
@@ -1062,7 +1062,7 @@ PyDoc_STRVAR(M_Geometry_box_pack_2d_doc,
static PyObject *M_Geometry_box_pack_2d(PyObject *UNUSED(self), PyObject *boxlist)
{
float tot_width= 0.0f, tot_height= 0.0f;
- int len;
+ Py_ssize_t len;
PyObject *ret;