From 9afe662c125fec5cf62b3976bf32194838f0d740 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 27 Dec 2006 05:04:20 +0000 Subject: renameing datablocks was imposing a name limit on the python side. This isnt needed because the limit is alredy being set by rename_id() some other minor changed- use None returning maro --- source/blender/python/api2_2x/Armature.c | 6 ++-- source/blender/python/api2_2x/Camera.c | 5 +-- source/blender/python/api2_2x/Curve.c | 46 +++++++++----------------- source/blender/python/api2_2x/Font.c | 11 +++---- source/blender/python/api2_2x/Group.c | 5 +-- source/blender/python/api2_2x/Image.c | 5 +-- source/blender/python/api2_2x/Ipo.c | 5 +-- source/blender/python/api2_2x/Lamp.c | 14 +++----- source/blender/python/api2_2x/Lattice.c | 35 +++++++------------- source/blender/python/api2_2x/MTex.c | 15 +++------ source/blender/python/api2_2x/Material.c | 25 +++++--------- source/blender/python/api2_2x/Mesh.c | 5 +-- source/blender/python/api2_2x/Metaball.c | 13 +++----- source/blender/python/api2_2x/NLA.c | 10 ++---- source/blender/python/api2_2x/Object.c | 6 ++-- source/blender/python/api2_2x/Pose.c | 23 +++++++------ source/blender/python/api2_2x/Scene.c | 5 +-- source/blender/python/api2_2x/Sound.c | 13 +++----- source/blender/python/api2_2x/Text.c | 20 ++++------- source/blender/python/api2_2x/Text3d.c | 38 ++++++++++----------- source/blender/python/api2_2x/Texture.c | 32 +++++++----------- source/blender/python/api2_2x/World.c | 55 +++++++++++-------------------- source/blender/python/api2_2x/gen_utils.c | 8 ++--- 23 files changed, 138 insertions(+), 262 deletions(-) (limited to 'source/blender') diff --git a/source/blender/python/api2_2x/Armature.c b/source/blender/python/api2_2x/Armature.c index a0c84b9aee9..2ccf0b7b774 100644 --- a/source/blender/python/api2_2x/Armature.c +++ b/source/blender/python/api2_2x/Armature.c @@ -943,14 +943,12 @@ static PyObject *Armature_getName(BPy_Armature *self, void *closure) //Sets the name of the armature static int Armature_setName(BPy_Armature *self, PyObject *value, void *closure) { - char buffer[24]; - char *name = ""; + char *name; if(value){ if(PyString_Check(value)){ name = PyString_AsString(value); - PyOS_snprintf(buffer, sizeof(buffer), "%s", name); - rename_id(&self->armature->id, buffer); + rename_id(&self->armature->id, name); return 0; } } diff --git a/source/blender/python/api2_2x/Camera.c b/source/blender/python/api2_2x/Camera.c index 053c15d1922..29e27478d52 100644 --- a/source/blender/python/api2_2x/Camera.c +++ b/source/blender/python/api2_2x/Camera.c @@ -624,15 +624,12 @@ static PyObject *Camera_oldclearIpo( BPy_Camera * self ) static PyObject *Camera_oldsetName( BPy_Camera * self, PyObject * args ) { char *name; - char buf[21]; if( !PyArg_ParseTuple( args, "s", &name ) ) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected string argument" ); - PyOS_snprintf( buf, sizeof( buf ), "%s", name ); - - rename_id( &self->camera->id, buf ); + rename_id( &self->camera->id, name ); Py_RETURN_NONE; } diff --git a/source/blender/python/api2_2x/Curve.c b/source/blender/python/api2_2x/Curve.c index 6ac26a02c95..19c303fa8dc 100644 --- a/source/blender/python/api2_2x/Curve.c +++ b/source/blender/python/api2_2x/Curve.c @@ -357,10 +357,8 @@ static PyObject *M_Curve_New( PyObject * self, PyObject * args ) "couldn't create Curve Data object" ) ); pycurve->curve = blcurve; /* link Python curve wrapper to Blender Curve */ - if( name ) { - PyOS_snprintf( buf, sizeof( buf ), "%s", name ); - rename_id( &blcurve->id, buf ); - } + if( name ) + rename_id( &blcurve->id, name ); return ( PyObject * ) pycurve; } @@ -472,18 +470,15 @@ PyObject *Curve_getName( BPy_Curve * self ) PyObject *Curve_setName( BPy_Curve * self, PyObject * args ) { char *name; - char buf[50]; if( !PyArg_ParseTuple( args, "s", &( name ) ) ) return ( EXPP_ReturnPyObjError( PyExc_AttributeError, "expected string argument" ) ); - PyOS_snprintf( buf, sizeof( buf ), "%s", name ); - rename_id( &self->curve->id, buf ); /* proper way in Blender */ - Curve_update( self ); + rename_id( &self->curve->id, name ); /* proper way in Blender */ - Py_INCREF( Py_None ); - return Py_None; + Curve_update( self ); + Py_RETURN_NONE; } static PyObject *Curve_getPathLen( BPy_Curve * self ) @@ -505,8 +500,7 @@ static PyObject *Curve_setPathLen( BPy_Curve * self, PyObject * args ) return ( EXPP_ReturnPyObjError( PyExc_AttributeError, "expected int argument" ) ); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } @@ -529,8 +523,7 @@ static PyObject *Curve_setTotcol( BPy_Curve * self, PyObject * args ) return ( EXPP_ReturnPyObjError( PyExc_AttributeError, "expected int argument" ) ); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } @@ -553,8 +546,7 @@ PyObject *Curve_setMode( BPy_Curve * self, PyObject * args ) return ( EXPP_ReturnPyObjError( PyExc_AttributeError, "expected int argument" ) ); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } @@ -776,8 +768,7 @@ static PyObject *Curve_setControlPoint(BPy_Curve *self, PyObject *args) ptrnurb->bezt[numpoint].vec[i][j] = bez[i*3+j]; } - Py_INCREF(Py_None); - return Py_None; + Py_RETURN_NONE; } */ @@ -794,10 +785,8 @@ static PyObject *Curve_setControlPoint( BPy_Curve * self, PyObject * args ) Nurb *ptrnurb = self->curve->nurb.first; int numcourbe = 0, numpoint = 0, i, j; - if( !ptrnurb ) { - Py_INCREF( Py_None ); - return Py_None; - } + if( !ptrnurb ) + Py_RETURN_NONE; if( ptrnurb->bp ) if( !PyArg_ParseTuple @@ -829,8 +818,7 @@ static PyObject *Curve_setControlPoint( BPy_Curve * self, PyObject * args ) ( listargs, i * 3 + j ) ); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } static PyObject *Curve_getControlPoint( BPy_Curve * self, PyObject * args ) @@ -912,8 +900,7 @@ static PyObject *Curve_setLoc( BPy_Curve * self, PyObject * args ) PyObject *xx = PyList_GetItem( listargs, i ); self->curve->loc[i] = (float)PyFloat_AsDouble( xx ); } - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } static PyObject *Curve_getRot( BPy_Curve * self ) @@ -942,9 +929,7 @@ static PyObject *Curve_setRot( BPy_Curve * self, PyObject * args ) PyObject *xx = PyList_GetItem( listargs, i ); self->curve->rot[i] = (float)PyFloat_AsDouble( xx ); } - Py_INCREF( Py_None ); - return Py_None; - + Py_RETURN_NONE; } static PyObject *Curve_getSize( BPy_Curve * self ) { @@ -971,8 +956,7 @@ static PyObject *Curve_setSize( BPy_Curve * self, PyObject * args ) PyObject *xx = PyList_GetItem( listargs, i ); self->curve->size[i] = (float)PyFloat_AsDouble( xx ); } - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } diff --git a/source/blender/python/api2_2x/Font.c b/source/blender/python/api2_2x/Font.c index b4f37332523..bb9b700727a 100644 --- a/source/blender/python/api2_2x/Font.c +++ b/source/blender/python/api2_2x/Font.c @@ -170,7 +170,7 @@ PyObject *M_Font_Load( PyObject * self, PyObject * args ) Py_DECREF (tmp); } else - return EXPP_incr_ret( Py_None ); + Py_RETURN_NONE; return ( PyObject * ) py_font; } @@ -207,7 +207,6 @@ static PyObject *Font_getFilename( BPy_Font * self ) static int Font_setName( BPy_Font * self, PyObject * value ) { char *name = NULL; - char buf[21]; if( !(self->font) ) return EXPP_ReturnIntError( PyExc_RuntimeError, @@ -218,10 +217,8 @@ static int Font_setName( BPy_Font * self, PyObject * value ) return EXPP_ReturnIntError( PyExc_TypeError, "expected string argument" ); - PyOS_snprintf( buf, sizeof( buf ), "%s", name ); + rename_id( &self->font->id, name ); - rename_id( &self->font->id, buf ); - return 0; } @@ -250,7 +247,7 @@ static PyObject *Font_pack( BPy_Font * self ) { if( !self->font->packedfile ) self->font->packedfile = newPackedFile(self->font->name); - return EXPP_incr_ret( Py_None ); + Py_RETURN_NONE; } /*--------------- BPy_Font.unpack()---------------------------------*/ @@ -269,7 +266,7 @@ static PyObject *Font_unpack( BPy_Font * self, PyObject * args ) return EXPP_ReturnPyObjError( PyExc_RuntimeError, "error unpacking font" ); - return EXPP_incr_ret( Py_None ); + Py_RETURN_NONE; } /*--------------- BPy_Font.packed---------------------------------*/ diff --git a/source/blender/python/api2_2x/Group.c b/source/blender/python/api2_2x/Group.c index 751567a1af2..25c6dba8c6e 100755 --- a/source/blender/python/api2_2x/Group.c +++ b/source/blender/python/api2_2x/Group.c @@ -217,7 +217,6 @@ static int Group_compare( BPy_Group * a, BPy_Group * b ); static int Group_setName( BPy_Group * self, PyObject * value ) { char *name = NULL; - char buf[22]; GROUP_DEL_CHECK_INT(self); @@ -226,9 +225,7 @@ static int Group_setName( BPy_Group * self, PyObject * value ) return EXPP_ReturnIntError( PyExc_TypeError, "expected string argument" ); - PyOS_snprintf( buf, sizeof( buf ), "%s", name ); - - rename_id( &self->group->id, buf ); + rename_id( &self->group->id, name ); return 0; } diff --git a/source/blender/python/api2_2x/Image.c b/source/blender/python/api2_2x/Image.c index 15a0582e9c6..20b8054dfed 100644 --- a/source/blender/python/api2_2x/Image.c +++ b/source/blender/python/api2_2x/Image.c @@ -989,15 +989,12 @@ static PyObject *Image_glLoad( BPy_Image * self ) static PyObject *Image_setName( BPy_Image * self, PyObject * args ) { char *name; - char buf[21]; if( !PyArg_ParseTuple( args, "s", &name ) ) return ( EXPP_ReturnPyObjError( PyExc_TypeError, "expected string argument" ) ); - PyOS_snprintf( buf, sizeof( buf ), "%s", name ); - - rename_id( &self->image->id, buf ); + rename_id( &self->image->id, name ); Py_RETURN_NONE; } diff --git a/source/blender/python/api2_2x/Ipo.c b/source/blender/python/api2_2x/Ipo.c index ef9dbc804b7..6a36079371b 100644 --- a/source/blender/python/api2_2x/Ipo.c +++ b/source/blender/python/api2_2x/Ipo.c @@ -819,16 +819,13 @@ static PyObject *Ipo_getName( BPy_Ipo * self ) static int Ipo_setName( BPy_Ipo * self, PyObject * args ) { char *name; - char buf[21]; name = PyString_AsString( args ); if( !name ) return EXPP_ReturnIntError( PyExc_TypeError, "expected string argument" ); - PyOS_snprintf( buf, sizeof( buf ), "%s", name ); - - rename_id( &self->ipo->id, buf ); + rename_id( &self->ipo->id, name ); return 0; } diff --git a/source/blender/python/api2_2x/Lamp.c b/source/blender/python/api2_2x/Lamp.c index 8ee188f2f2d..0ccc408e434 100644 --- a/source/blender/python/api2_2x/Lamp.c +++ b/source/blender/python/api2_2x/Lamp.c @@ -653,10 +653,8 @@ static PyObject *M_Lamp_New( PyObject * self, PyObject * args, if( strcmp( name_str, "LampData" ) == 0 ) return ( PyObject * ) py_lamp; - else { /* user gave us a name for the lamp, use it */ - PyOS_snprintf( buf, sizeof( buf ), "%s", name_str ); - rename_id( &bl_lamp->id, buf ); - } + else /* user gave us a name for the lamp, use it */ + rename_id( &bl_lamp->id, name_str ); return ( PyObject * ) py_lamp; } @@ -1448,10 +1446,8 @@ static PyObject *Lamp_getIpo( BPy_Lamp * self ) { struct Ipo *ipo = self->lamp->ipo; - if( !ipo ) { - Py_INCREF( Py_None ); - return Py_None; - } + if( !ipo ) + Py_RETURN_NONE; return Ipo_CreatePyObject( ipo ); } @@ -1547,7 +1543,7 @@ static PyObject *Lamp_insertIpoKey( BPy_Lamp * self, PyObject * args ) EXPP_allqueue(REDRAWACTION, 0); EXPP_allqueue(REDRAWNLA, 0); - return EXPP_incr_ret( Py_None ); + Py_RETURN_NONE; } static PyObject *Lamp_getModesConst( void ) diff --git a/source/blender/python/api2_2x/Lattice.c b/source/blender/python/api2_2x/Lattice.c index 297da2edd8d..0837773b8a2 100644 --- a/source/blender/python/api2_2x/Lattice.c +++ b/source/blender/python/api2_2x/Lattice.c @@ -255,7 +255,6 @@ int Lattice_CheckPyObject( PyObject * pyobj ) static PyObject *M_Lattice_New( PyObject * self, PyObject * args ) { char *name = NULL; - char buf[21]; Lattice *bl_Lattice; // blender Lattice object PyObject *py_Lattice; // python wrapper @@ -275,10 +274,8 @@ static PyObject *M_Lattice_New( PyObject * self, PyObject * args ) return EXPP_ReturnPyObjError( PyExc_MemoryError, "couldn't create Lattice Object wrapper" ); - if( name ) { - PyOS_snprintf( buf, sizeof( buf ), "%s", name ); - rename_id( &bl_Lattice->id, buf ); - } + if( name ) + rename_id( &bl_Lattice->id, name ); return py_Lattice; } @@ -393,18 +390,14 @@ static PyObject *Lattice_getName( BPy_Lattice * self ) static PyObject *Lattice_setName( BPy_Lattice * self, PyObject * args ) { char *name; - char buf[21]; if( !PyArg_ParseTuple( args, "s", &name ) ) return ( EXPP_ReturnPyObjError( PyExc_TypeError, "expected string argument" ) ); - PyOS_snprintf( buf, sizeof( buf ), "%s", name ); - - rename_id( &self->Lattice->id, buf ); + rename_id( &self->Lattice->id, name ); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } static PyObject *Lattice_setPartitions( BPy_Lattice * self, PyObject * args ) @@ -426,8 +419,7 @@ static PyObject *Lattice_setPartitions( BPy_Lattice * self, PyObject * args ) resizelattice(bl_Lattice, x, y, z, NULL); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } static PyObject *Lattice_getPartitions( BPy_Lattice * self ) @@ -446,9 +438,8 @@ static PyObject *Lattice_getKey( BPy_Lattice * self ) if (key) return Key_CreatePyObject(key); - else { - return EXPP_incr_ret(Py_None); - } + else + Py_RETURN_NONE; } static PyObject *Lattice_getKeyTypes( BPy_Lattice * self ) @@ -538,8 +529,7 @@ static PyObject *Lattice_setKeyTypes( BPy_Lattice * self, PyObject * args ) return EXPP_ReturnPyObjError( PyExc_TypeError, "type must be LINEAR, CARDINAL OR BSPLINE" ); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } static PyObject *Lattice_setMode( BPy_Lattice * self, PyObject * args ) @@ -561,8 +551,7 @@ static PyObject *Lattice_setMode( BPy_Lattice * self, PyObject * args ) return EXPP_ReturnPyObjError( PyExc_TypeError, "type must be either GRID or OUTSIDE" ); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } static PyObject *Lattice_getMode( BPy_Lattice * self ) @@ -639,8 +628,7 @@ static PyObject *Lattice_setPoint( BPy_Lattice * self, PyObject * args ) bpoint->vec[x] = tempInt; } - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } static PyObject *Lattice_getPoint( BPy_Lattice * self, PyObject * args ) @@ -714,8 +702,7 @@ static PyObject *Lattice_insertKey( BPy_Lattice * self, PyObject * args ) if( frame > 0 ) G.scene->r.cfra = (int)oldfra; - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } static PyObject *Lattice_copy( BPy_Lattice * self ) diff --git a/source/blender/python/api2_2x/MTex.c b/source/blender/python/api2_2x/MTex.c index 848d28edfa0..6e896448792 100644 --- a/source/blender/python/api2_2x/MTex.c +++ b/source/blender/python/api2_2x/MTex.c @@ -299,8 +299,7 @@ static PyObject *MTex_setTexMethod( BPy_MTex * self, PyObject * args ) if( self->mtex->tex ) self->mtex->tex->id.us++; - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } static void MTex_dealloc( BPy_MTex * self ) @@ -327,10 +326,8 @@ static PyObject *MTex_getTex( BPy_MTex *self, void *closure ) { if( self->mtex->tex ) return Texture_CreatePyObject( self->mtex->tex ); - else { - Py_INCREF( Py_None ); - return Py_None; - } + else + Py_RETURN_NONE; } static int MTex_setTex( BPy_MTex *self, PyObject *value, void *closure) @@ -389,10 +386,8 @@ static PyObject *MTex_getObject( BPy_MTex *self, void *closure ) { if( self->mtex->object ) return Object_CreatePyObject( self->mtex->object ); - else { - Py_INCREF( Py_None ); - return Py_None; - } + else + Py_RETURN_NONE; } static int MTex_setObject( BPy_MTex *self, PyObject *value, void *closure) diff --git a/source/blender/python/api2_2x/Material.c b/source/blender/python/api2_2x/Material.c index 13e78d3eda4..4dc83ba6ca2 100644 --- a/source/blender/python/api2_2x/Material.c +++ b/source/blender/python/api2_2x/Material.c @@ -1304,10 +1304,8 @@ static PyObject *Material_getIpo( BPy_Material * self ) { Ipo *ipo = self->material->ipo; - if( !ipo ) { - Py_INCREF( Py_None ); - return Py_None; - } + if( !ipo ) + Py_RETURN_NONE; return Ipo_CreatePyObject( ipo ); } @@ -2004,22 +2002,19 @@ static PyObject *Material_insertIpoKey( BPy_Material * self, PyObject * args ) EXPP_allqueue(REDRAWACTION, 0); EXPP_allqueue(REDRAWNLA, 0); - return EXPP_incr_ret( Py_None ); + Py_RETURN_NONE; } static int Material_setName( BPy_Material * self, PyObject * value ) { char *name; - char buf[21]; name = PyString_AsString ( value ); if( !name ) return EXPP_ReturnIntError( PyExc_TypeError, "expected string argument" ); - PyOS_snprintf( buf, sizeof( buf ), "%s", name ); - - rename_id( &self->material->id, buf ); + rename_id( &self->material->id, name ); return 0; } @@ -2453,8 +2448,7 @@ static PyObject *Material_setTexture( BPy_Material * self, PyObject * args ) self->material->mtex[texnum]->texco = (short)texco; self->material->mtex[texnum]->mapto = (short)mapto; - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } static PyObject *Material_clearTexture( BPy_Material * self, PyObject * args ) @@ -2477,8 +2471,7 @@ static PyObject *Material_clearTexture( BPy_Material * self, PyObject * args ) self->material->mtex[texnum] = NULL; } - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } /* mat.addScriptLink */ @@ -2778,8 +2771,7 @@ static PyObject *Material_getOopsLoc ( BPy_Material * self ) oops = oops->next; } } - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } static PyObject *Material_getOopsSel ( BPy_Material * self ) @@ -2797,8 +2789,7 @@ static PyObject *Material_getOopsSel ( BPy_Material * self ) oops = oops->next; } } - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } static int Material_setOopsLoc ( BPy_Material * self, PyObject * value ) diff --git a/source/blender/python/api2_2x/Mesh.c b/source/blender/python/api2_2x/Mesh.c index 32b1eecb8bc..794e3a963fc 100644 --- a/source/blender/python/api2_2x/Mesh.c +++ b/source/blender/python/api2_2x/Mesh.c @@ -7156,16 +7156,13 @@ static PyObject *Mesh_getName( BPy_Mesh * self ) static int Mesh_setName( BPy_Mesh * self, PyObject * value ) { char *name; - char buf[21]; name = PyString_AsString ( value ); if( !name ) return EXPP_ReturnIntError( PyExc_TypeError, "expected string argument" ); - PyOS_snprintf( buf, sizeof( buf ), "%s", name ); - - rename_id( &self->mesh->id, buf ); + rename_id( &self->mesh->id, name ); return 0; } diff --git a/source/blender/python/api2_2x/Metaball.c b/source/blender/python/api2_2x/Metaball.c index bfa985ea133..ac24573710f 100644 --- a/source/blender/python/api2_2x/Metaball.c +++ b/source/blender/python/api2_2x/Metaball.c @@ -426,7 +426,7 @@ static PyObject *M_Metaball_New( PyObject * self, PyObject * args ) char *name = 0; BPy_Metaball *pymball; /* for Data object wrapper in Python */ MetaBall *blmball; /* for actual Data we create in Blender */ - char buf[21]; + if( !PyArg_ParseTuple( args, "|s", &name ) ) return ( EXPP_ReturnPyObjError( PyExc_TypeError, "expected string argument (or nothing)" ) ); @@ -450,10 +450,9 @@ static PyObject *M_Metaball_New( PyObject * self, PyObject * args ) pymball->metaball = blmball; /*link Python mballer wrapper to Blender MetaBall */ - if( name ) { /* user gave us a name for the metaball, use it */ - PyOS_snprintf( buf, sizeof( buf ), "%s", name ); - rename_id( &blmball->id, buf ); - } + if( name ) /* user gave us a name for the metaball, use it */ + rename_id( &blmball->id, name ); + return ( PyObject * ) pymball; } @@ -583,14 +582,12 @@ static PyObject *Metaball_getName( BPy_Metaball * self ) static int Metaball_setName( BPy_Metaball * self, PyObject * value ) { char *name = NULL; - char buf[21]; name = PyString_AsString ( value ); if( !name ) return ( EXPP_ReturnIntError( PyExc_TypeError, "expected string argument" ) ); - PyOS_snprintf( buf, sizeof( buf ), "%s", name ); - rename_id( &self->metaball->id, buf ); + rename_id( &self->metaball->id, name ); return 0; } diff --git a/source/blender/python/api2_2x/NLA.c b/source/blender/python/api2_2x/NLA.c index f729d2cf99b..61d5c447418 100644 --- a/source/blender/python/api2_2x/NLA.c +++ b/source/blender/python/api2_2x/NLA.c @@ -260,7 +260,6 @@ static PyObject *Action_getName( BPy_Action * self ) static PyObject *Action_setName( BPy_Action * self, PyObject * args ) { char *name; - char buf[21]; if( !self->action ) ( EXPP_ReturnPyObjError( PyExc_RuntimeError, @@ -271,8 +270,7 @@ static PyObject *Action_setName( BPy_Action * self, PyObject * args ) "expected string argument" ) ); /*change name*/ - PyOS_snprintf( buf, sizeof( buf ), "%s", name ); - rename_id( &self->action->id, buf); + rename_id( &self->action->id, name); Py_RETURN_NONE; } @@ -371,8 +369,7 @@ static PyObject *Action_verifyChannel( BPy_Action * self, PyObject * args ) chan = verify_action_channel(self->action, chanName); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } @@ -400,8 +397,7 @@ static PyObject *Action_removeChannel( BPy_Action * self, PyObject * args ) /*remove channel*/ BLI_freelinkN( &self->action->chanbase, chan ); - Py_INCREF( Py_None ); - return ( Py_None ); + Py_RETURN_NONE; } static PyObject *Action_getAllChannelIpos( BPy_Action * self ) diff --git a/source/blender/python/api2_2x/Object.c b/source/blender/python/api2_2x/Object.c index 28cd0dcd0f3..87acb90c5fe 100644 --- a/source/blender/python/api2_2x/Object.c +++ b/source/blender/python/api2_2x/Object.c @@ -2710,15 +2710,13 @@ static PyObject *Object_setMaterials( BPy_Object * self, PyObject * args ) static int Object_setName( BPy_Object * self, PyObject * args ) { char *name; - char buf[21]; name = PyString_AsString ( args ); if( !name ) return EXPP_ReturnIntError( PyExc_TypeError, "expected a string argument" ); - - PyOS_snprintf( buf, sizeof( buf ), "%s", name ); - rename_id( &self->object->id, buf ); + + rename_id( &self->object->id, name ); return 0; } diff --git a/source/blender/python/api2_2x/Pose.c b/source/blender/python/api2_2x/Pose.c index 39086a14881..76f875650e7 100644 --- a/source/blender/python/api2_2x/Pose.c +++ b/source/blender/python/api2_2x/Pose.c @@ -180,9 +180,9 @@ static PyObject *PoseBonesDict_GetItem(BPy_PoseBonesDict *self, PyObject* key) PyObject *value = NULL; value = PyDict_GetItem(self->bonesMap, key); - if(value == NULL){ - return EXPP_incr_ret(Py_None); - } + if(value == NULL) + Py_RETURN_NONE; + return EXPP_incr_ret(value); } //------------------TYPE_OBECT DEFINITION-------------------------- @@ -290,7 +290,7 @@ static PyObject *Pose_update(BPy_Pose *self) if(daddy) where_is_pose(daddy); - return EXPP_incr_ret(Py_None); + Py_RETURN_NONE; } //------------------------tp_methods //This contains a list of all methods the object contains @@ -513,7 +513,7 @@ static PyObject *PoseBone_insertKey(BPy_PoseBone *self, PyObject *args) //update the IPOs remake_action_ipos (((BPy_Object*)parent_object)->object->action); - return EXPP_incr_ret(Py_None); + Py_RETURN_NONE; AttributeError: return EXPP_objError(PyExc_AttributeError, "%s%s%s", @@ -941,11 +941,10 @@ static int PoseBone_setSelect(BPy_PoseBone *self, PyObject *value, void *closure //Gets the pose bones selection static PyObject *PoseBone_getParent(BPy_PoseBone *self, void *closure) { - if (self->posechannel->parent) { + if (self->posechannel->parent) return PyPoseBone_FromPosechannel(self->posechannel->parent); - } else { - return EXPP_incr_ret(Py_None); - } + else + Py_RETURN_NONE; } //------------------TYPE_OBECT IMPLEMENTATION--------------------------- @@ -1060,7 +1059,7 @@ PyObject *Pose_Init(void) //Initializes TypeObject.ob_type if (PyType_Ready(&Pose_Type) < 0 || PyType_Ready(&PoseBone_Type) < 0 || PyType_Ready(&PoseBonesDict_Type) < 0) { - return EXPP_incr_ret(Py_None); + Py_RETURN_NONE; } //Register the module @@ -1105,7 +1104,7 @@ PyObject *PyPose_FromPose(bPose *pose, char *name) return (PyObject*)py_pose; }else{ - return EXPP_incr_ret(Py_None); + Py_RETURN_NONE; } RuntimeError: @@ -1125,7 +1124,7 @@ PyObject *PyPoseBone_FromPosechannel(bPoseChannel *pchan) py_posechannel->posechannel = pchan; return (PyObject*)py_posechannel; }else{ - return EXPP_incr_ret(Py_None); + Py_RETURN_NONE; } RuntimeError: diff --git a/source/blender/python/api2_2x/Scene.c b/source/blender/python/api2_2x/Scene.c index e433ba04be1..ee254df8bc1 100644 --- a/source/blender/python/api2_2x/Scene.c +++ b/source/blender/python/api2_2x/Scene.c @@ -574,17 +574,14 @@ static PyObject *Scene_getName( BPy_Scene * self ) static PyObject *Scene_setName( BPy_Scene * self, PyObject * args ) { char *name; - char buf[21]; SCENE_DEL_CHECK_PY(self); if( !PyArg_ParseTuple( args, "s", &name ) ) return ( EXPP_ReturnPyObjError( PyExc_TypeError, "expected string argument" ) ); - - PyOS_snprintf( buf, sizeof( buf ), "%s", name ); - rename_id( &self->scene->id, buf ); + rename_id( &self->scene->id, name ); Py_RETURN_NONE; } diff --git a/source/blender/python/api2_2x/Sound.c b/source/blender/python/api2_2x/Sound.c index 166645eb99c..3f0cea118d4 100644 --- a/source/blender/python/api2_2x/Sound.c +++ b/source/blender/python/api2_2x/Sound.c @@ -423,16 +423,13 @@ static PyObject *Sound_getFilename( BPy_Sound * self ) static PyObject *Sound_setName( BPy_Sound * self, PyObject * args ) { char *name; - char buf[21]; if( !PyArg_ParseTuple( args, "s", &name ) ) { return ( EXPP_ReturnPyObjError( PyExc_AttributeError, "expected a String as argument" ) ); } - PyOS_snprintf( buf, sizeof( buf ), "%s", name ); - - rename_id( &self->sound->id, buf ); + rename_id( &self->sound->id, name ); Py_RETURN_NONE; } @@ -463,8 +460,7 @@ static PyObject *Sound_play( BPy_Sound * self ) { sound_play_sound( self->sound ); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } static PyObject *Sound_setCurrent( BPy_Sound * self ) @@ -480,8 +476,7 @@ static PyObject *Sound_setCurrent( BPy_Sound * self ) EXPP_allqueue( REDRAWSOUND, 0 ); EXPP_allqueue( REDRAWBUTSLOGIC, 0 ); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } /* unpack sound */ @@ -538,7 +533,7 @@ static PyObject *Sound_reload( BPy_Sound * self) sound->snd_sound = NULL; } - return EXPP_incr_ret( Py_None ); + Py_RETURN_NONE; } */ diff --git a/source/blender/python/api2_2x/Text.c b/source/blender/python/api2_2x/Text.c index b5a5f7cf21d..ddfb1b0044f 100644 --- a/source/blender/python/api2_2x/Text.c +++ b/source/blender/python/api2_2x/Text.c @@ -342,8 +342,7 @@ static PyObject *M_Text_unlink( PyObject * self, PyObject * args ) ( ( BPy_Text * ) textobj )->text = NULL; - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } /*****************************************************************************/ @@ -437,18 +436,14 @@ static PyObject *Text_getNLines( BPy_Text * self ) static PyObject *Text_setName( BPy_Text * self, PyObject * args ) { char *name; - char buf[21]; if( !PyArg_ParseTuple( args, "s", &name ) ) return ( EXPP_ReturnPyObjError( PyExc_TypeError, "expected string argument" ) ); - PyOS_snprintf( buf, sizeof( buf ), "%s", name ); - - rename_id( &self->text->id, buf ); + rename_id( &self->text->id, name ); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } static PyObject *Text_clear( BPy_Text * self) @@ -465,8 +460,7 @@ static PyObject *Text_clear( BPy_Text * self) txt_cut_sel( self->text ); txt_set_undostate( oldstate ); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } static PyObject *Text_set( BPy_Text * self, PyObject * args ) @@ -485,8 +479,7 @@ static PyObject *Text_set( BPy_Text * self, PyObject * args ) self->text->flags &= EXPP_TEXT_MODE_FOLLOW; } - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } static PyObject *Text_write( BPy_Text * self, PyObject * args ) @@ -507,8 +500,7 @@ static PyObject *Text_write( BPy_Text * self, PyObject * args ) txt_move_eof( self->text, 0 ); txt_set_undostate( oldstate ); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } static PyObject *Text_asLines( BPy_Text * self ) diff --git a/source/blender/python/api2_2x/Text3d.c b/source/blender/python/api2_2x/Text3d.c index e77fae4d96f..fc1f1a60aca 100644 --- a/source/blender/python/api2_2x/Text3d.c +++ b/source/blender/python/api2_2x/Text3d.c @@ -236,9 +236,7 @@ PyTypeObject Text3d_Type = { static PyObject *Text3d_update( BPy_Text3d * self ) { freedisplist( &self->curve->disp ); - - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } /*****************************************************************************/ @@ -248,7 +246,6 @@ static PyObject *Text3d_update( BPy_Text3d * self ) PyObject *M_Text3d_New( PyObject * self, PyObject * args ) { - char buf[24]; char *name = NULL; BPy_Text3d *pytext3d; /* for Curve Data object wrapper in Python */ Text3d *bltext3d = 0; /* for actual Curve Data we create in Blender */ @@ -286,10 +283,9 @@ PyObject *M_Text3d_New( PyObject * self, PyObject * args ) "couldn't create Curve Data object" ) ); pytext3d->curve = bltext3d; /* link Python curve wrapper to Blender Curve */ - if( name ) { - PyOS_snprintf( buf, sizeof( buf ), "%s", name ); - rename_id( &bltext3d->id, buf ); - } + if( name ) + rename_id( &bltext3d->id, name ); + Text3d_update ( pytext3d ); return ( PyObject * ) pytext3d; } @@ -623,7 +619,7 @@ static PyObject* Text3d_setDrawMode(BPy_Text3d* self,PyObject* args) Py_DECREF(v); } Py_DECREF(listObject); - return EXPP_incr_ret( Py_None ); + Py_RETURN_NONE; } static PyObject* Text3d_getUVorco(BPy_Text3d* self) @@ -651,7 +647,7 @@ static PyObject* Text3d_setUVorco(BPy_Text3d* self,PyObject* args) else self->curve->flag &= ~CU_UV_ORCO; - return EXPP_incr_ret( Py_None ); + Py_RETURN_NONE; } static PyObject* Text3d_getBevelAmount(BPy_Text3d* self) @@ -728,7 +724,7 @@ static PyObject *Text3d_setShear( BPy_Text3d * self, PyObject * args ) "acceptable values are between 1.0 and -1.0" ) ); self->curve->shear = value; - return EXPP_incr_ret( Py_None ); + Py_RETURN_NONE; } static PyObject *Text3d_getSize( BPy_Text3d * self ) @@ -755,7 +751,7 @@ static PyObject *Text3d_setSize( BPy_Text3d * self, PyObject * args ) "acceptable values are between 10.0 and 0.1" ) ); self->curve->fsize = value; - return EXPP_incr_ret( Py_None ); + Py_RETURN_NONE; } static PyObject *Text3d_getLineSeparation( BPy_Text3d * self ) @@ -782,7 +778,7 @@ static PyObject *Text3d_setLineSeparation( BPy_Text3d * self, PyObject * args ) "acceptable values are between 10.0 and 0.0" ) ); self->curve->linedist = value; - return EXPP_incr_ret( Py_None ); + Py_RETURN_NONE; } static PyObject *Text3d_getSpacing( BPy_Text3d * self ) @@ -809,7 +805,7 @@ static PyObject *Text3d_setSpacing( BPy_Text3d * self, PyObject * args ) "acceptable values are between 10.0 and 0.0" ) ); self->curve->spacing = value; - return EXPP_incr_ret( Py_None ); + Py_RETURN_NONE; } static PyObject *Text3d_getXoffset( BPy_Text3d * self ) { @@ -835,7 +831,7 @@ static PyObject *Text3d_setXoffset( BPy_Text3d * self, PyObject * args ) "acceptable values are between 50.0 and -50.0" ) ); self->curve->xof = value; - return EXPP_incr_ret( Py_None ); + Py_RETURN_NONE; } static PyObject *Text3d_getYoffset( BPy_Text3d * self ) @@ -862,7 +858,7 @@ static PyObject *Text3d_setYoffset( BPy_Text3d * self, PyObject * args ) "acceptable values are between 50.0 and -50.0" ) ); self->curve->yof = value; - return EXPP_incr_ret( Py_None ); + Py_RETURN_NONE; } static PyObject *Text3d_getAlignment( BPy_Text3d * self ) @@ -892,7 +888,7 @@ static PyObject *Text3d_setAlignment( BPy_Text3d * self, PyObject * args ) value = PyInt_AS_LONG(PyDict_GetItemString(constant->dict, "value")); self->curve->spacemode = (short)value; - return EXPP_incr_ret( Py_None ); + Py_RETURN_NONE; } @@ -922,7 +918,7 @@ static PyObject *Text3d_getFont( BPy_Text3d * self ) if (self->curve) return Font_CreatePyObject (self->curve->vfont); else - return EXPP_incr_ret( Py_None ); + Py_RETURN_NONE; } static PyObject *Text3d_setFont( BPy_Text3d * self, PyObject * args ) @@ -935,7 +931,7 @@ static PyObject *Text3d_setFont( BPy_Text3d * self, PyObject * args ) if( !pyobj ) { // pyobj= M_Text3d_LoadFont (self, Py_BuildValue("(s)", "")); self->curve->vfont= get_builtin_font (); - return EXPP_incr_ret( Py_None ); + Py_RETURN_NONE; } vf= exist_vfont(pyobj->font->name); if (vf) { @@ -952,7 +948,7 @@ static PyObject *Text3d_setFont( BPy_Text3d * self, PyObject * args ) self->curve->vfont= vf; } } - return EXPP_incr_ret( Py_None ); + Py_RETURN_NONE; } PyObject *M_Text3d_LoadFont( PyObject * self, PyObject * args ) @@ -979,7 +975,7 @@ PyObject *M_Text3d_LoadFont( PyObject * self, PyObject * args ) vf = exist_vfont( fontfile ); if(vf) return Font_CreatePyObject( vf ); - return EXPP_incr_ret( Py_None ); + Py_RETURN_NONE; } return EXPP_ReturnPyObjError( PyExc_TypeError, diff --git a/source/blender/python/api2_2x/Texture.c b/source/blender/python/api2_2x/Texture.c index 8d94632e70f..5fdfc7cfaea 100644 --- a/source/blender/python/api2_2x/Texture.c +++ b/source/blender/python/api2_2x/Texture.c @@ -1891,8 +1891,7 @@ static int Texture_setDistMetric( BPy_Texture * self, PyObject * value ) return EXPP_ReturnPyObjError( PyExc_ValueError, "invalid dist metric type" ); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; #else return EXPP_setIValueRange ( value, &self->texture->vn_distm, TEX_DISTANCE, @@ -1946,10 +1945,8 @@ static PyObject *Texture_getIpo( BPy_Texture * self ) { struct Ipo *ipo = self->texture->ipo; - if( !ipo ) { - Py_INCREF( Py_None ); - return Py_None; - } + if( !ipo ) + Py_RETURN_NONE; return Ipo_CreatePyObject( ipo ); } @@ -1996,7 +1993,7 @@ static int Texture_setIpo( BPy_Texture * self, PyObject * value ) self->texture->ipo = ipo; if ( ipo ) { id = &ipo->id; - id_us_plus(id); //id->us++; + id_us_plus(id); } return 0; @@ -2554,8 +2551,7 @@ static PyObject *Texture_oldsetType( BPy_Texture * self, PyObject * args ) self->texture->env->object= OBACT; } - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } static PyObject *Texture_oldsetExtend( BPy_Texture * self, PyObject * args ) @@ -2570,8 +2566,7 @@ static PyObject *Texture_oldsetExtend( BPy_Texture * self, PyObject * args ) return EXPP_ReturnPyObjError( PyExc_ValueError, "invalid extend mode" ); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } /* @@ -2600,8 +2595,7 @@ static PyObject *Texture_oldsetNoiseBasis( BPy_Texture * self, PyObject * args ) return EXPP_ReturnPyObjError( PyExc_ValueError, "invalid noise basis" ); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } static PyObject *Texture_oldsetDistNoise( BPy_Texture * self, PyObject * args ) @@ -2618,8 +2612,7 @@ static PyObject *Texture_oldsetDistNoise( BPy_Texture * self, PyObject * args ) return EXPP_ReturnPyObjError( PyExc_ValueError, "invalid noise basis" ); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } static PyObject *Texture_oldsetSType( BPy_Texture * self, PyObject * args ) @@ -2648,8 +2641,7 @@ static PyObject *Texture_oldsetSType( BPy_Texture * self, PyObject * args ) return EXPP_ReturnPyObjError( PyExc_ValueError, "invalid texture stype" ); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } static PyObject *Texture_oldsetDistMetric( BPy_Texture * self, PyObject * args ) @@ -2667,8 +2659,7 @@ static PyObject *Texture_oldsetDistMetric( BPy_Texture * self, PyObject * args ) return EXPP_ReturnPyObjError( PyExc_ValueError, "invalid dist metric type" ); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } static PyObject *Texture_oldsetImageFlags( BPy_Texture * self, PyObject * args ) @@ -2699,7 +2690,6 @@ static PyObject *Texture_oldsetImageFlags( BPy_Texture * self, PyObject * args ) self->texture->imaflag = (short)flag; - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } diff --git a/source/blender/python/api2_2x/World.c b/source/blender/python/api2_2x/World.c index 742a70c21b4..e4fb48ed20d 100644 --- a/source/blender/python/api2_2x/World.c +++ b/source/blender/python/api2_2x/World.c @@ -382,10 +382,9 @@ static PyObject *M_World_Get( PyObject * self, PyObject * args ) static PyObject *M_World_GetCurrent( PyObject * self ) { BPy_World *w = NULL; - if( !G.scene->world ) { - Py_INCREF( Py_None ); - return Py_None; - } + if( !G.scene->world ) + Py_RETURN_NONE; + w = ( BPy_World * ) PyObject_NEW( BPy_World, &World_Type ); w->world = G.scene->world; return ( PyObject * ) w; @@ -436,8 +435,7 @@ static PyObject *World_setRange( BPy_World * self, PyObject * args ) return ( EXPP_ReturnPyObjError ( PyExc_TypeError, "expected a float argument" ) ); self->world->range = range; - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } @@ -445,10 +443,8 @@ static PyObject *World_getIpo( BPy_World * self ) { struct Ipo *ipo = self->world->ipo; - if( !ipo ) { - Py_INCREF( Py_None ); - return Py_None; - } + if( !ipo ) + Py_RETURN_NONE; return Ipo_CreatePyObject( ipo ); } @@ -484,8 +480,7 @@ static PyObject *World_setIpo( BPy_World * self, PyObject * args ) self->world->ipo = ipo; - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } static PyObject *World_clearIpo( BPy_World * self ) @@ -530,15 +525,12 @@ static PyObject *World_getName( BPy_World * self ) static PyObject *World_setName( BPy_World * self, PyObject * args ) { char *name = 0; - char buf[21]; if( !PyArg_ParseTuple( args, "s", &name ) ) return ( EXPP_ReturnPyObjError ( PyExc_TypeError, "expected string argument" ) ); - snprintf( buf, sizeof( buf ), "%s", name ); - rename_id( &self->world->id, buf ); + rename_id( &self->world->id, name ); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } @@ -577,8 +569,7 @@ static PyObject *World_setSkytype( BPy_World * self, PyObject * args ) return ( EXPP_ReturnPyObjError( PyExc_TypeError, "expected int argument" ) ); self->world->skytype = (short)skytype; - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } @@ -614,8 +605,7 @@ static PyObject *World_setMode( BPy_World * self, PyObject * args ) return ( EXPP_ReturnPyObjError( PyExc_TypeError, "expected int argument" ) ); self->world->mode = (short)mode; - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } @@ -663,8 +653,7 @@ static PyObject *World_setMistype( BPy_World * self, PyObject * args ) return ( EXPP_ReturnPyObjError( PyExc_TypeError, "expected int argument" ) ); self->world->mistype = (short)mistype; - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } @@ -693,8 +682,7 @@ static PyObject *World_setHor( BPy_World * self, PyObject * args ) self->world->horr = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 0 ) ); self->world->horg = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 1 ) ); self->world->horb = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) ); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } @@ -720,8 +708,7 @@ static PyObject *World_setZen( BPy_World * self, PyObject * args ) self->world->zenr = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 0 ) ); self->world->zeng = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 1 ) ); self->world->zenb = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) ); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } @@ -755,8 +742,7 @@ static PyObject *World_setAmb( BPy_World * self, PyObject * args ) self->world->ambr = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 0 ) ); self->world->ambg = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 1 ) ); self->world->ambb = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) ); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } @@ -800,8 +786,7 @@ static PyObject *World_setStar( BPy_World * self, PyObject * args ) (float)PyFloat_AsDouble( PyList_GetItem( listargs, 5 ) ); self->world->starcolnoise = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 6 ) ); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } @@ -842,8 +827,7 @@ static PyObject *World_setMist( BPy_World * self, PyObject * args ) (float)PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) ); self->world->misthi = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 3 ) ); - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } /* world.addScriptLink */ @@ -896,8 +880,7 @@ static PyObject *World_setCurrent( BPy_World * self ) G.scene->world->id.us--; world->id.us++; G.scene->world = world; - Py_INCREF( Py_None ); - return Py_None; + Py_RETURN_NONE; } /* world.__copy__ */ @@ -1179,5 +1162,5 @@ static PyObject *World_insertIpoKey( BPy_World * self, PyObject * args ) EXPP_allqueue(REDRAWACTION, 0); EXPP_allqueue(REDRAWNLA, 0); - return EXPP_incr_ret( Py_None ); + Py_RETURN_NONE; } diff --git a/source/blender/python/api2_2x/gen_utils.c b/source/blender/python/api2_2x/gen_utils.c index 027598efe69..641992ecb43 100644 --- a/source/blender/python/api2_2x/gen_utils.c +++ b/source/blender/python/api2_2x/gen_utils.c @@ -685,13 +685,13 @@ int EXPP_setFloatClamped( PyObject *value, float *param, int EXPP_setIValueClamped( PyObject *value, void *param, int min, int max, char type ) { - char errstr[128]; int number; - sprintf ( errstr, "expected int argument in [%d,%d]", min, max ); - - if( !PyInt_CheckExact ( value ) ) + if( !PyInt_CheckExact ( value ) ) { + char errstr[128]; + sprintf ( errstr, "expected int argument in [%d,%d]", min, max ); return EXPP_ReturnIntError( PyExc_TypeError, errstr ); + } number = PyInt_AS_LONG( value ); -- cgit v1.2.3