bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 5/5] uname: Put platform-dependent checks one after another.


From: Paolo Bonzini
Subject: [PATCH 5/5] uname: Put platform-dependent checks one after another.
Date: Thu, 1 Oct 2009 14:15:11 +0200

Finally a couple of tweaks.  I move computation of sysname towards
the end of the function, so that the compiler can thread from one
if to the following switch (I don't know if it does, but it
looked nice...).

Also, in case this is being compiled with MSVC I do append the
version number to the uname -m value.  I did this after checking
that the existing return value would never match anything in
config.guess.

* lib/uname.c: Move sysname computation after release/version.
Append version number even if not on Mingw.
---
 ChangeLog   |    6 ++++++
 lib/uname.c |   30 ++++++++++++++++--------------
 2 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 50d746d..79a2db4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2009-10-01  Paolo Bonzini  <address@hidden>
 
+       uname: Put platform-dependent checks one after another.
+       * lib/uname.c: Move sysname computation after release/version.
+       Append version number even if not on Mingw.
+
+2009-10-01  Paolo Bonzini  <address@hidden>
+
        Handle Windows CE and rewrite NT version handling.
        * lib/uname.c: Handle Windows CE and its processor types.  Remove
        code for processors never supported by Windows 95/98/ME.  Rewrite
diff --git a/lib/uname.c b/lib/uname.c
index a63d150..4413786 100644
--- a/lib/uname.c
+++ b/lib/uname.c
@@ -91,20 +91,6 @@ uname (struct utsname *buf)
   else
     super_version = "";
 
-  /* Fill in sysname.  */
-#ifdef __MINGW32__
-  /* Returns a string compatible with the MSYS uname.exe program,
-     so that no further changes are needed to GNU config.guess.
-     For example,
-       $ ./uname.exe -s      => MINGW32_NT-5.1
-   */
-  sprintf (buf->sysname, "MINGW32_%s-%u.%u", super_version,
-          (unsigned int) version.dwMajorVersion,
-          (unsigned int) version.dwMinorVersion);
-#else
-  sprintf (buf->sysname, "Windows%s", super_version);
-#endif
-
   /* Fill in release, version.  */
   /* The MSYS uname.exe programs uses strings from a modified Cygwin runtime:
        $ ./uname.exe -r      => 1.0.11(0.46/3/2)
@@ -159,6 +145,22 @@ uname (struct utsname *buf)
 
   strcpy (buf->version, version.szCSDVersion);
 
+  /* Fill in sysname.  */
+  /* Returns a string compatible with the MSYS uname.exe program,
+     so that no further changes are needed to GNU config.guess.
+     For example,
+       $ ./uname.exe -s      => MINGW32_NT-5.1
+   */
+  sprintf (buf->sysname, "%s%s-%u.%u", 
+#ifdef __MINGW32__
+         "MINGW32_",
+#else
+         "Windows",
+#endif
+          super_version,
+          (unsigned int) version.dwMajorVersion,
+          (unsigned int) version.dwMinorVersion);
+
   /* Fill in machine.  */
   {
     SYSTEM_INFO info;
-- 
1.6.2.5





reply via email to

[Prev in Thread] Current Thread [Next in Thread]