[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39841] trunk/blender/source/blender/ python/intern/bpy_rna.c: use a fixed 32byte buffer for getting an rna string from python.
Campbell Barton
ideasman42 at gmail.com
Thu Sep 1 11:47:22 CEST 2011
Revision: 39841
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39841
Author: campbellbarton
Date: 2011-09-01 09:47:21 +0000 (Thu, 01 Sep 2011)
Log Message:
-----------
use a fixed 32byte buffer for getting an rna string from python. gives a slight speedup when drawing heavy UI's
Modified Paths:
--------------
trunk/blender/source/blender/python/intern/bpy_rna.c
Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c 2011-09-01 09:46:07 UTC (rev 39840)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c 2011-09-01 09:47:21 UTC (rev 39841)
@@ -1298,7 +1298,9 @@
{
int subtype= RNA_property_subtype(prop);
const char *buf;
- buf= RNA_property_string_get_alloc(ptr, prop, NULL, -1);
+ char buf_fixed[32];
+
+ buf= RNA_property_string_get_alloc(ptr, prop, buf_fixed, sizeof(buf_fixed));
#ifdef USE_STRING_COERCE
/* only file paths get special treatment, they may contain non utf-8 chars */
if(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
@@ -1310,7 +1312,9 @@
#else // USE_STRING_COERCE
ret= PyUnicode_FromString(buf);
#endif // USE_STRING_COERCE
- MEM_freeN((void *)buf);
+ if(buf_fixed != buf) {
+ MEM_freeN((void *)buf);
+ }
break;
}
case PROP_ENUM:
More information about the Bf-blender-cvs
mailing list