1
0
Fork 0

clutter/actor: Steal instead of duplicating the last token value

Instead of duplicating a string we own already we can just steal it from
the array that we're using.

This is safe since we're sure about the tokens GStrv length and we are
always stealing the last element, so there is no risk that g_strfreev
would eventually leak something.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4071>
This commit is contained in:
Marco Trevisan (Treviño) 2024-10-07 11:24:10 +02:00 committed by Marge Bot
parent 101126176a
commit 2aac24deac

View file

@ -12029,7 +12029,7 @@ get_layout_from_animation_property (ClutterActor *actor,
} }
if (name_p != NULL) if (name_p != NULL)
*name_p = g_strdup (tokens[1]); *name_p = g_steal_pointer (&tokens[1]);
return TRUE; return TRUE;
} }
@ -12060,7 +12060,7 @@ get_content_from_animation_property (ClutterActor *actor,
} }
if (name_p != NULL) if (name_p != NULL)
*name_p = g_strdup (tokens[1]); *name_p = g_steal_pointer (&tokens[1]);
return TRUE; return TRUE;
} }
@ -12109,7 +12109,7 @@ get_meta_from_animation_property (ClutterActor *actor,
meta = _clutter_meta_group_get_meta (priv->effects, tokens[1]); meta = _clutter_meta_group_get_meta (priv->effects, tokens[1]);
if (name_p != NULL) if (name_p != NULL)
*name_p = g_strdup (tokens[2]); *name_p = g_steal_pointer (&tokens[2]);
CLUTTER_NOTE (ANIMATION, CLUTTER_NOTE (ANIMATION,
"Looking for property '%s' of object '%s' in section '%s'", "Looking for property '%s' of object '%s' in section '%s'",