[PATCH setup 1/3] Move is_64bit to state
Jon Turney
jon.turney@dronecode.org.uk
Sun Apr 27 18:41:35 GMT 2025
This controls stuff all over the place!
---
ini.h | 1 -
main.cc | 34 ++++++++++++++--------------------
state.cc | 6 ++++++
state.h | 2 ++
4 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/ini.h b/ini.h
index ecc4b78..68072b0 100644
--- a/ini.h
+++ b/ini.h
@@ -23,7 +23,6 @@ class io_stream;
typedef std::vector <std::string> IniList;
extern IniList found_ini_list, setup_ext_list;
const std::string setup_exts[] = { "zst", "xz", "bz2", "ini" };
-extern bool is_64bit;
extern bool is_new_install;
extern std::string SetupArch;
extern std::string SetupIniDir;
diff --git a/main.cc b/main.cc
index cf9e323..ea74887 100644
--- a/main.cc
+++ b/main.cc
@@ -82,7 +82,6 @@
extern char **_argv;
#endif
-bool is_64bit;
bool is_new_install = false;
std::string SetupArch;
std::string SetupIniDir;
@@ -262,26 +261,21 @@ WinMain (HINSTANCE h,
else if (HelpOption)
help_option = true;
- if (!((std::string) Arch).size ())
+ if (((std::string) Arch).size ())
{
-#ifdef __x86_64__
- is_64bit = true;
-#else
- is_64bit = false;
-#endif
- }
- else if (((std::string) Arch).find ("64") != std::string::npos)
- is_64bit = true;
- else if (((std::string) Arch).find ("32") != std::string::npos
- || ((std::string) Arch).find ("x86") != std::string::npos)
- is_64bit = false;
- else
- {
- char buff[80 + ((std::string) Arch).size ()];
- sprintf (buff, "Invalid option for --arch: \"%s\"",
- ((std::string) Arch).c_str ());
- fprintf (stderr, "*** %s\n", buff);
- exit (1);
+ if (((std::string) Arch).find ("64") != std::string::npos)
+ is_64bit = true;
+ else if (((std::string) Arch).find ("32") != std::string::npos
+ || ((std::string) Arch).find ("x86") != std::string::npos)
+ is_64bit = false;
+ else
+ {
+ char buff[80 + ((std::string) Arch).size ()];
+ sprintf (buff, "Invalid option for --arch: \"%s\"",
+ ((std::string) Arch).c_str ());
+ fprintf (stderr, "*** %s\n", buff);
+ exit (1);
+ }
}
if (GuiLangOption.isPresent())
diff --git a/state.cc b/state.cc
index 111b890..ef14116 100644
--- a/state.cc
+++ b/state.cc
@@ -29,3 +29,9 @@ int root_menu;
int root_desktop;
LANGID langid;
+
+#ifdef __x86_64__
+bool is_64bit = true;
+#else
+bool is_64bit = false;
+#endif
diff --git a/state.h b/state.h
index b211de3..c4b88a4 100644
--- a/state.h
+++ b/state.h
@@ -48,4 +48,6 @@ extern int root_desktop;
extern LANGID langid;
+extern bool is_64bit;
+
#endif /* SETUP_STATE_H */
--
2.45.1
More information about the Cygwin-apps
mailing list