From 1985d9ccddf8660c52e3dc11fbf68823d46c7afd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 7 Oct 2024 11:16:20 +0200 Subject: [PATCH] clutter/actor: Avoid computing GStrv length for simple checks No need to do a full iteration of the tokens or doing null-checks here since g_strsplit() is not nullable, while there's no need to do a full length check either. Part-of: --- clutter/clutter/clutter-actor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c index 1e6d926d4..9a25be527 100644 --- a/clutter/clutter/clutter-actor.c +++ b/clutter/clutter/clutter-actor.c @@ -12021,7 +12021,7 @@ get_layout_from_animation_property (ClutterActor *actor, return FALSE; tokens = g_strsplit (name, ".", -1); - if (tokens == NULL || g_strv_length (tokens) != 2) + if (tokens[0] == NULL || tokens[1] == NULL || tokens[2] != NULL) { CLUTTER_NOTE (ANIMATION, "Invalid property name '%s'", name + 1); @@ -12052,7 +12052,7 @@ get_content_from_animation_property (ClutterActor *actor, } tokens = g_strsplit (name, ".", -1); - if (tokens == NULL || g_strv_length (tokens) != 2) + if (tokens[0] == NULL || tokens[1] == NULL || tokens[2] != NULL) { CLUTTER_NOTE (ANIMATION, "Invalid property name '%s'", name + 1); @@ -12092,7 +12092,7 @@ get_meta_from_animation_property (ClutterActor *actor, */ tokens = g_strsplit (name + 1, ".", -1); - if (tokens == NULL || g_strv_length (tokens) != 3) + if (g_strv_length (tokens) != 3) { CLUTTER_NOTE (ANIMATION, "Invalid property name '%s'", name + 1);