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. --- source/blender/editors/armature/pose_select.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'source/blender/editors/armature') diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c index 1dbb859fd6c..4db8569a7d2 100644 --- a/source/blender/editors/armature/pose_select.c +++ b/source/blender/editors/armature/pose_select.c @@ -1106,20 +1106,18 @@ static bool pose_select_same_keyingset(bContext *C, ReportList *reports, bool ex for (ksp = ks->paths.first; ksp; ksp = ksp->next) { /* 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_str_quoted_substrN(ksp->rna_path, "bones["); - - if (boneName) { - bPoseChannel *pchan = BKE_pose_channel_find_name(pose, boneName); - MEM_freeN(boneName); - - if (pchan) { - /* select if bone is visible and can be affected */ - if (PBONE_SELECTABLE(arm, pchan->bone)) { - pchan->bone->flag |= BONE_SELECTED; - changed = true; - } - } + char *boneName = BLI_str_quoted_substrN(ksp->rna_path, "bones["); + if (boneName == NULL) { + continue; + } + bPoseChannel *pchan = BKE_pose_channel_find_name(pose, boneName); + MEM_freeN(boneName); + + if (pchan) { + /* select if bone is visible and can be affected */ + if (PBONE_SELECTABLE(arm, pchan->bone)) { + pchan->bone->flag |= BONE_SELECTED; + changed = true; } } } -- cgit v1.2.3