Fix some compiler warnings for Win32/mingw64 build (mono/mono#15903)
authorNikolay Sivov <nsivov@codeweavers.com>
Wed, 31 Jul 2019 12:18:53 +0000 (15:18 +0300)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Wed, 31 Jul 2019 12:18:53 +0000 (14:18 +0200)
* [mono] Fix unused variable warning in mono_config_parse().

* [ligc] Fix strict prototype warning for Win32 build.

* Add some casts.

Commit migrated from https://github.com/mono/mono/commit/c8fd75734b7f34ed42968bf7ed9b315303b31abc

src/mono/mono/metadata/mono-config.c

index 8c1c644..287fa2a 100644 (file)
@@ -661,35 +661,29 @@ mono_config_for_assembly_internal (MonoImage *assembly)
  * (or the file in the \c MONO_CONFIG env var).
  */
 void
-mono_config_parse (const char *filename) {
-       const char *home;
-       char *mono_cfg;
-#ifndef TARGET_WIN32
-       char *user_cfg;
-#endif
-
+mono_config_parse (const char *filename)
+{
        if (filename) {
                mono_config_parse_file (filename);
                return;
        }
 
-       // FIXME: leak, do we store any references to home
-       char *env_home = g_getenv ("MONO_CONFIG");
-       if (env_home) {
-               mono_config_parse_file (env_home);
+       const char *home = g_getenv ("MONO_CONFIG");
+       if (home) {
+               mono_config_parse_file (home);
                return;
        }
 
        const char *cfg_dir = mono_get_config_dir ();
        if (cfg_dir) {
-               mono_cfg = g_build_filename (cfg_dir, "mono", "config", NULL);
+               char *mono_cfg = g_build_filename (cfg_dir, "mono", "config", (const char *)NULL);
                mono_config_parse_file (mono_cfg);
                g_free (mono_cfg);
        }
 
 #if !defined(TARGET_WIN32)
        home = g_get_home_dir ();
-       user_cfg = g_strconcat (home, G_DIR_SEPARATOR_S, ".mono/config", NULL);
+       char *user_cfg = g_strconcat (home, G_DIR_SEPARATOR_S, ".mono/config", (const char *)NULL);
        mono_config_parse_file (user_cfg);
        g_free (user_cfg);
 #endif