[libmanette] mapping: Simplify the *_try_free funcs
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libmanette] mapping: Simplify the *_try_free funcs
- Date: Sun, 22 Nov 2020 08:23:17 +0000 (UTC)
commit f4d588bad4ec0843b9da05a9766bf96027fdef8e
Author: Adrien Plazas <kekun plazas laposte net>
Date: Sat Nov 21 09:20:30 2020 +0100
mapping: Simplify the *_try_free funcs
This makes the functions trying to free some data simpler and hopefully
more optimized.
src/manette-mapping.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
---
diff --git a/src/manette-mapping.c b/src/manette-mapping.c
index 7a8e899..1de26eb 100644
--- a/src/manette-mapping.c
+++ b/src/manette-mapping.c
@@ -297,13 +297,8 @@ parse_destination_input (gchar *start,
static void
manette_mapping_binding_try_free (ManetteMappingBinding **binding)
{
- if (binding == NULL)
- return;
-
- if (*binding == NULL)
- return;
-
- manette_mapping_binding_free (*binding);
+ if (G_LIKELY (binding && *binding))
+ manette_mapping_binding_free (*binding);
}
static void
@@ -502,13 +497,8 @@ set_from_mapping_string (ManetteMapping *self,
static void
g_array_try_free (GArray **array)
{
- if (array == NULL)
- return;
-
- if (*array == NULL)
- return;
-
- g_array_free (*array, TRUE);
+ if (G_LIKELY (array && *array))
+ g_array_free (*array, TRUE);
}
ManetteMapping *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]