Deduplicate string for plugins' block prefix in clawsrc.
authorAndrej Kacian <ticho@claws-mail.org>
Sun, 21 Aug 2016 20:59:42 +0000 (22:59 +0200)
committerAndrej Kacian <ticho@claws-mail.org>
Sun, 21 Aug 2016 20:59:42 +0000 (22:59 +0200)
src/common/plugin.c

index 91c8ef1..5677214 100644 (file)
 #include "claws.h"
 #include "timing.h"
 
+#ifdef G_OS_WIN32
+#define PLUGINS_BLOCK_PREFIX "PluginsWin32_"
+#else
+#define PLUGINS_BLOCK_PREFIX "Plugins_"
+#endif
+
 struct _Plugin
 {
        gchar   *filename;
@@ -142,11 +148,7 @@ void plugin_save_list(void)
        
        for (type_cur = plugin_types; type_cur != NULL; type_cur = g_slist_next(type_cur)) {
                rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL);
-#ifdef G_OS_WIN32
-               block = g_strconcat("PluginsWin32_", type_cur->data, NULL);
-#else
-               block = g_strconcat("Plugins_", type_cur->data, NULL);
-#endif
+               block = g_strconcat(PLUGINS_BLOCK_PREFIX, type_cur->data, NULL);
                if ((pfile = prefs_write_open(rcpath)) == NULL ||
                    (prefs_set_block_label(pfile, block) < 0)) {
                        g_warning("failed to write plugin list");
@@ -593,11 +595,7 @@ void plugin_load_all(const gchar *type)
        plugin_types = g_slist_append(plugin_types, g_strdup(type));
 
        rcpath = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, COMMON_RC, NULL); 
-#ifdef G_OS_WIN32
-       block = g_strconcat("PluginsWin32_", type, NULL);
-#else
-       block = g_strconcat("Plugins_", type, NULL);
-#endif
+       block = g_strconcat(PLUGINS_BLOCK_PREFIX, type, NULL);
        if ((pfile = prefs_read_open(rcpath)) == NULL ||
            (prefs_set_block_label(pfile, block) < 0)) {
                g_free(rcpath);