mirror of
https://github.com/brl/mutter.git
synced 2024-11-27 02:20:43 -05:00
script: Do not allocate memory when not needed
When printing out the property value during a ClutterScript debug run we generate the value's content using g_strdup_value_contents() - though we do it unconditionally. The contents might not be printed (they most likely won't, actually) and will be freed afterwards. This is unnecessary: we can allocate the contents string after checking if we're going to print out the debug note, thus avoiding the whole allocation/free cycle unless strictly needed.
This commit is contained in:
parent
a39cef41b8
commit
f935270aa0
@ -8037,6 +8037,7 @@ clutter_actor_set_custom_property (ClutterScriptable *scriptable,
|
|||||||
const GValue *value)
|
const GValue *value)
|
||||||
{
|
{
|
||||||
#ifdef CLUTTER_ENABLE_DEBUG
|
#ifdef CLUTTER_ENABLE_DEBUG
|
||||||
|
if (G_UNLIKELY (clutter_debug_flags & CLUTTER_DEBUG_SCRIPT))
|
||||||
{
|
{
|
||||||
gchar *tmp = g_strdup_value_contents (value);
|
gchar *tmp = g_strdup_value_contents (value);
|
||||||
|
|
||||||
@ -8047,7 +8048,7 @@ clutter_actor_set_custom_property (ClutterScriptable *scriptable,
|
|||||||
|
|
||||||
g_free (tmp);
|
g_free (tmp);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* CLUTTER_ENABLE_DEBUG */
|
||||||
|
|
||||||
if (strcmp (name, "rotation") == 0)
|
if (strcmp (name, "rotation") == 0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user