[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48772] trunk/blender/source/blender: rename BLI_getQuotedStr --> BLI_str_quoted_substrN to make it more clear its doing an allocation.
Campbell Barton
ideasman42 at gmail.com
Tue Jul 10 00:16:52 CEST 2012
Revision: 48772
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48772
Author: campbellbarton
Date: 2012-07-09 22:16:50 +0000 (Mon, 09 Jul 2012)
Log Message:
-----------
rename BLI_getQuotedStr --> BLI_str_quoted_substrN to make it more clear its doing an allocation.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/fcurve.c
trunk/blender/source/blender/blenlib/BLI_string.h
trunk/blender/source/blender/blenlib/intern/string.c
trunk/blender/source/blender/editors/animation/anim_deps.c
trunk/blender/source/blender/editors/animation/anim_filter.c
trunk/blender/source/blender/editors/animation/anim_ipo_utils.c
trunk/blender/source/blender/editors/armature/poseobject.c
trunk/blender/source/blender/editors/transform/transform_conversions.c
Modified: trunk/blender/source/blender/blenkernel/intern/fcurve.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/fcurve.c 2012-07-09 21:57:04 UTC (rev 48771)
+++ trunk/blender/source/blender/blenkernel/intern/fcurve.c 2012-07-09 22:16:50 UTC (rev 48772)
@@ -285,12 +285,12 @@
for (fcu = src->first; fcu; fcu = fcu->next) {
/* check if quoted string matches the path */
if ((fcu->rna_path) && strstr(fcu->rna_path, dataPrefix)) {
- char *quotedName = BLI_getQuotedStr(fcu->rna_path, dataPrefix);
+ char *quotedName = BLI_str_quoted_substrN(fcu->rna_path, dataPrefix);
if (quotedName) {
/* check if the quoted name matches the required name */
if (strcmp(quotedName, dataName) == 0) {
- LinkData *ld = MEM_callocN(sizeof(LinkData), "list_find_data_fcurves");
+ LinkData *ld = MEM_callocN(sizeof(LinkData), __func__);
ld->data = fcu;
BLI_addtail(dst, ld);
Modified: trunk/blender/source/blender/blenlib/BLI_string.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_string.h 2012-07-09 21:57:04 UTC (rev 48771)
+++ trunk/blender/source/blender/blenlib/BLI_string.h 2012-07-09 22:16:50 UTC (rev 48772)
@@ -105,7 +105,7 @@
* Assume that the strings returned must be freed afterwards, and that the inputs will contain
* data we want...
*/
-char *BLI_getQuotedStr(const char *str, const char *prefix)
+char *BLI_str_quoted_substrN(const char *str, const char *prefix)
#ifdef __GNUC__
__attribute__((warn_unused_result))
__attribute__((nonnull))
Modified: trunk/blender/source/blender/blenlib/intern/string.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/string.c 2012-07-09 21:57:04 UTC (rev 48771)
+++ trunk/blender/source/blender/blenlib/intern/string.c 2012-07-09 22:16:50 UTC (rev 48772)
@@ -168,8 +168,10 @@
*
* Assume that the strings returned must be freed afterwards, and that the inputs will contain
* data we want...
+ *
+ * TODO, return the offset and a length so as to avoid doing an allocation.
*/
-char *BLI_getQuotedStr(const char *str, const char *prefix)
+char *BLI_str_quoted_substrN(const char *str, const char *prefix)
{
size_t prefixLen = strlen(prefix);
char *startMatch, *endMatch;
Modified: trunk/blender/source/blender/editors/animation/anim_deps.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_deps.c 2012-07-09 21:57:04 UTC (rev 48771)
+++ trunk/blender/source/blender/editors/animation/anim_deps.c 2012-07-09 22:16:50 UTC (rev 48772)
@@ -178,7 +178,7 @@
char *bone_name;
/* get bone-name, and check if this bone is selected */
- bone_name = BLI_getQuotedStr(fcu->rna_path, "pose.bones[");
+ bone_name = BLI_str_quoted_substrN(fcu->rna_path, "pose.bones[");
pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
if (bone_name) MEM_freeN(bone_name);
@@ -201,7 +201,7 @@
char *seq_name;
/* get strip name, and check if this strip is selected */
- seq_name = BLI_getQuotedStr(fcu->rna_path, "sequences_all[");
+ seq_name = BLI_str_quoted_substrN(fcu->rna_path, "sequences_all[");
seq = get_seq_by_name(ed->seqbasep, seq_name, FALSE);
if (seq_name) MEM_freeN(seq_name);
@@ -223,7 +223,7 @@
char *node_name;
/* get strip name, and check if this strip is selected */
- node_name = BLI_getQuotedStr(fcu->rna_path, "nodes[");
+ node_name = BLI_str_quoted_substrN(fcu->rna_path, "nodes[");
node = nodeFindNodebyName(ntree, node_name);
if (node_name) MEM_freeN(node_name);
Modified: trunk/blender/source/blender/editors/animation/anim_filter.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_filter.c 2012-07-09 21:57:04 UTC (rev 48771)
+++ trunk/blender/source/blender/editors/animation/anim_filter.c 2012-07-09 22:16:50 UTC (rev 48772)
@@ -880,7 +880,7 @@
char *bone_name;
/* get bone-name, and check if this bone is selected */
- bone_name = BLI_getQuotedStr(fcu->rna_path, "pose.bones[");
+ bone_name = BLI_str_quoted_substrN(fcu->rna_path, "pose.bones[");
pchan = BKE_pose_channel_find_name(ob->pose, bone_name);
if (bone_name) MEM_freeN(bone_name);
@@ -916,7 +916,7 @@
char *seq_name;
/* get strip name, and check if this strip is selected */
- seq_name = BLI_getQuotedStr(fcu->rna_path, "sequences_all[");
+ seq_name = BLI_str_quoted_substrN(fcu->rna_path, "sequences_all[");
seq = get_seq_by_name(ed->seqbasep, seq_name, FALSE);
if (seq_name) MEM_freeN(seq_name);
@@ -936,7 +936,7 @@
char *node_name;
/* get strip name, and check if this strip is selected */
- node_name = BLI_getQuotedStr(fcu->rna_path, "nodes[");
+ node_name = BLI_str_quoted_substrN(fcu->rna_path, "nodes[");
node = nodeFindNodebyName(ntree, node_name);
if (node_name) MEM_freeN(node_name);
Modified: trunk/blender/source/blender/editors/animation/anim_ipo_utils.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_ipo_utils.c 2012-07-09 21:57:04 UTC (rev 48771)
+++ trunk/blender/source/blender/editors/animation/anim_ipo_utils.c 2012-07-09 22:16:50 UTC (rev 48772)
@@ -104,8 +104,8 @@
*/
if (strstr(fcu->rna_path, "bones") && strstr(fcu->rna_path, "constraints")) {
/* perform string 'chopping' to get "Bone Name : Constraint Name" */
- char *pchanName = BLI_getQuotedStr(fcu->rna_path, "bones[");
- char *constName = BLI_getQuotedStr(fcu->rna_path, "constraints[");
+ char *pchanName = BLI_str_quoted_substrN(fcu->rna_path, "bones[");
+ char *constName = BLI_str_quoted_substrN(fcu->rna_path, "constraints[");
/* assemble the string to display in the UI... */
structname = BLI_sprintfN("%s : %s", pchanName, constName);
Modified: trunk/blender/source/blender/editors/armature/poseobject.c
===================================================================
--- trunk/blender/source/blender/editors/armature/poseobject.c 2012-07-09 21:57:04 UTC (rev 48771)
+++ trunk/blender/source/blender/editors/armature/poseobject.c 2012-07-09 22:16:50 UTC (rev 48772)
@@ -694,7 +694,7 @@
/* only items related to this object will be relevant */
if ((ksp->id == &ob->id) && (ksp->rna_path != NULL)) {
if (strstr(ksp->rna_path, "bones")) {
- char *boneName = BLI_getQuotedStr(ksp->rna_path, "bones[");
+ char *boneName = BLI_str_quoted_substrN(ksp->rna_path, "bones[");
if (boneName) {
bPoseChannel *pchan = BKE_pose_channel_find_name(pose, boneName);
Modified: trunk/blender/source/blender/editors/transform/transform_conversions.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_conversions.c 2012-07-09 21:57:04 UTC (rev 48771)
+++ trunk/blender/source/blender/editors/transform/transform_conversions.c 2012-07-09 22:16:50 UTC (rev 48772)
@@ -4880,7 +4880,7 @@
for (fcu = act->curves.first; fcu; fcu = fcu->next) {
/* only insert keyframes for this F-Curve if it affects the current bone */
if (strstr(fcu->rna_path, "bones")) {
- char *pchanName = BLI_getQuotedStr(fcu->rna_path, "bones[");
+ char *pchanName = BLI_str_quoted_substrN(fcu->rna_path, "bones[");
/* only if bone name matches too...
* NOTE: this will do constraints too, but those are ok to do here too?
More information about the Bf-blender-cvs
mailing list