mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -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,17 +8037,18 @@ clutter_actor_set_custom_property (ClutterScriptable *scriptable,
|
||||
const GValue *value)
|
||||
{
|
||||
#ifdef CLUTTER_ENABLE_DEBUG
|
||||
{
|
||||
gchar *tmp = g_strdup_value_contents (value);
|
||||
if (G_UNLIKELY (clutter_debug_flags & CLUTTER_DEBUG_SCRIPT))
|
||||
{
|
||||
gchar *tmp = g_strdup_value_contents (value);
|
||||
|
||||
CLUTTER_NOTE (SCRIPT,
|
||||
"in ClutterActor::set_custom_property('%s') = %s",
|
||||
name,
|
||||
tmp);
|
||||
CLUTTER_NOTE (SCRIPT,
|
||||
"in ClutterActor::set_custom_property('%s') = %s",
|
||||
name,
|
||||
tmp);
|
||||
|
||||
g_free (tmp);
|
||||
}
|
||||
#endif
|
||||
g_free (tmp);
|
||||
}
|
||||
#endif /* CLUTTER_ENABLE_DEBUG */
|
||||
|
||||
if (strcmp (name, "rotation") == 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user