diff options
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 4 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_string.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/string.c | 4 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_deps.c | 6 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_filter.c | 6 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_ipo_utils.c | 4 | ||||
-rw-r--r-- | source/blender/editors/armature/poseobject.c | 2 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 2 |
8 files changed, 16 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 38c1709d79a..97b245bd067 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -285,12 +285,12 @@ int list_find_data_fcurves(ListBase *dst, ListBase *src, const char *dataPrefix, 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); diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h index 8fde8fcf13f..a74629e589c 100644 --- a/source/blender/blenlib/BLI_string.h +++ b/source/blender/blenlib/BLI_string.h @@ -105,7 +105,7 @@ __attribute__((nonnull)) * 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)) diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index d86d151b1ef..7a750a74a33 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -168,8 +168,10 @@ escape_finish: * * 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; diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c index 32cbbc79496..50bdbd6673c 100644 --- a/source/blender/editors/animation/anim_deps.c +++ b/source/blender/editors/animation/anim_deps.c @@ -178,7 +178,7 @@ static void animchan_sync_fcurve(bAnimContext *UNUSED(ac), bAnimListElem *ale) 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 @@ static void animchan_sync_fcurve(bAnimContext *UNUSED(ac), bAnimListElem *ale) 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 @@ static void animchan_sync_fcurve(bAnimContext *UNUSED(ac), bAnimListElem *ale) 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); diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index e239719d894..6144cc4ecc1 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -880,7 +880,7 @@ static short skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_i 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 @@ static short skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_i 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 @@ static short skip_fcurve_selected_data(bDopeSheet *ads, FCurve *fcu, ID *owner_i 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); diff --git a/source/blender/editors/animation/anim_ipo_utils.c b/source/blender/editors/animation/anim_ipo_utils.c index 35782c3b3ae..5295950546d 100644 --- a/source/blender/editors/animation/anim_ipo_utils.c +++ b/source/blender/editors/animation/anim_ipo_utils.c @@ -104,8 +104,8 @@ int getname_anim_fcurve(char *name, ID *id, FCurve *fcu) */ 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); diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index f837d8a726e..cd2ca16fec5 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -694,7 +694,7 @@ static int pose_select_same_keyingset(bContext *C, Object *ob, short extend) /* 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); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index d7241555cc7..949266a0cc2 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -4880,7 +4880,7 @@ void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *o 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? |