From 90dac47717b12f33d5dd738da12a337cfe4f2f14 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 1 Sep 2021 15:23:56 +1000 Subject: Cleanup: remove redundant strstr calls Rely on BLI_str_quoted_substrN to detect if the prefix exists since this function exists early there is no need to check before calling. --- .../editors/transform/transform_convert_armature.c | 34 ++++++++++------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'source/blender/editors/transform') diff --git a/source/blender/editors/transform/transform_convert_armature.c b/source/blender/editors/transform/transform_convert_armature.c index 5627a910ab4..98e00c20170 100644 --- a/source/blender/editors/transform/transform_convert_armature.c +++ b/source/blender/editors/transform/transform_convert_armature.c @@ -145,31 +145,29 @@ static void autokeyframe_pose( if (act) { 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") == NULL) { + char *pchanName = BLI_str_quoted_substrN(fcu->rna_path, "bones["); + if (pchanName == NULL) { continue; } - 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? */ - if (pchanName) { - if (STREQ(pchanName, pchan->name)) { - insert_keyframe(bmain, - reports, - id, - act, - ((fcu->grp) ? (fcu->grp->name) : (NULL)), - fcu->rna_path, - fcu->array_index, - &anim_eval_context, - ts->keyframe_type, - &nla_cache, - flag); - } - - MEM_freeN(pchanName); + if (STREQ(pchanName, pchan->name)) { + insert_keyframe(bmain, + reports, + id, + act, + ((fcu->grp) ? (fcu->grp->name) : (NULL)), + fcu->rna_path, + fcu->array_index, + &anim_eval_context, + ts->keyframe_type, + &nla_cache, + flag); } + + MEM_freeN(pchanName); } } } -- cgit v1.2.3