helper: fix build with mingw gcc 12.1.0
[fw/openocd] / src / helper / configuration.c
index 7e791d08489740782175e47487ca2775557501f9..614892c8a94f21552bae20515290bae91eb9ed9f 100644 (file)
@@ -148,6 +148,10 @@ int parse_config_file(struct command_context *cmd_ctx)
 
 char *get_home_dir(const char *append_path)
 {
+#ifdef _WIN32
+       char homepath[MAX_PATH];
+#endif
+
        char *home = getenv("HOME");
 
        if (!home) {
@@ -156,8 +160,6 @@ char *get_home_dir(const char *append_path)
                home = getenv("USERPROFILE");
 
                if (!home) {
-
-                       char homepath[MAX_PATH];
                        char *drive = getenv("HOMEDRIVE");
                        char *path = getenv("HOMEPATH");
                        if (drive && path) {