To eliminate the warning, the argv variable could be only declared/freed in the #ifndef G_OS_WIN32 blocks because it's unused on linux.

I tried with the following changes:

diff --git a/geanyctags/src/geanyctags.c b/geanyctags/src/geanyctags.c
index 2cea2246..74d80002 100644
--- a/geanyctags/src/geanyctags.c
+++ b/geanyctags/src/geanyctags.c
@@ -111,7 +111,9 @@ static void plugin_geanyctags_help (G_GNUC_UNUSED GeanyPlugin *plugin, G_GNUC_UN
 static void spawn_cmd(const gchar *cmd, const gchar *dir)
 {
 	GError *error = NULL;
+#ifndef G_OS_WIN32
 	gchar **argv = NULL;
+#endif
 	gchar *working_dir;
 	gchar *utf8_working_dir;
 	gchar *utf8_cmd_string;
@@ -162,7 +164,9 @@ static void spawn_cmd(const gchar *cmd, const gchar *dir)
 		msgwin_msg_add(COLOR_BLACK, -1, NULL, "%s", out);
 	}
 
+#ifndef G_OS_WIN32
 	g_strfreev(argv);
+#endif
 	g_free(working_dir);
 	g_free(out);
 }

but it results in the same warning. I guess cppcheck ignores '#ifdef`s.

We can just suppress the warnings for this and also for the vimode warning.
See "Supressions" on http://cppcheck.net/manual.html and https://github.com/geany/geany-plugins/blob/7c540bf347d0f0c6f6ab5123fa8f226b2f9152ee/geanyprj/src/Makefile.am#L26.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <geany/geany-plugins/issues/1196/1246000276@github.com>