[libnotify] notification: Do not duplicate calls on parse functions



commit 997e2e374a77cc4b02777efdc02d8338da11fb30
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Fri Apr 22 01:01:56 2022 +0200

    notification: Do not duplicate calls on parse functions

 libnotify/notification.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/libnotify/notification.c b/libnotify/notification.c
index d3e3b6f..54d8169 100644
--- a/libnotify/notification.c
+++ b/libnotify/notification.c
@@ -1033,24 +1033,24 @@ maybe_parse_snap_hint_value (NotifyNotification *notification,
                              const gchar *key,
                              GVariant    *value)
 {
+        StringParserFunc parse_func = NULL;
+
         if (!notification->priv->snap_path)
                 return value;
 
         if (g_strcmp0 (key, "desktop-entry") == 0) {
-                value = get_parsed_variant (notification,
-                                            key,
-                                            value,
-                                            try_prepend_snap_desktop);
+                parse_func = try_prepend_snap_desktop;
         } else if (g_strcmp0 (key, "image-path") == 0 ||
                    g_strcmp0 (key, "image_path") == 0 ||
                    g_strcmp0 (key, "sound-file") == 0) {
-                value = get_parsed_variant (notification,
-                                            key,
-                                            value,
-                                            try_prepend_snap);
+                parse_func = try_prepend_snap;
+        }
+
+        if (parse_func == NULL) {
+                return value;
         }
 
-        return value;
+        return get_parsed_variant (notification, key, value, parse_func);
 }
 
 /**


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]