bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH 2/3 v2] uname: Big reindentation


From: Paolo Bonzini
Subject: [PATCH 2/3 v2] uname: Big reindentation
Date: Fri, 2 Oct 2009 03:00:08 +0200

* lib/uname.c: Assume version info is available and do big reindentation.
---
        diff uses -b for readability. 1/3 + 2/3 are exactly
        the same as 2/5 + 3/5 from the previous series.

 ChangeLog   |    7 +++
 lib/uname.c |  150 ++++++++++++++++++++++++++--------------------------------
 2 files changed, 74 insertions(+), 83 deletions(-)

diff --git a/lib/uname.c b/lib/uname.c
index 18c611c..ed747e1 100644
--- a/lib/uname.c
+++ b/lib/uname.c
@@ -52,10 +52,10 @@ uname (struct utsname *buf)
       memset (&version, 0, sizeof (version));
       version.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
       have_version = GetVersionEx ((OSVERSIONINFO *) &version);
+      if (!have_version)
+       abort ();
     }
 
-  if (have_version)
-    {
       if (version.dwPlatformId == VER_PLATFORM_WIN32_NT)
        {
          /* Windows NT or newer.  */
@@ -82,9 +82,6 @@ uname (struct utsname *buf)
        }
       else
        super_version = "";
-    }
-  else
-    super_version = "";
 
   /* Fill in sysname.  */
 #ifdef __MINGW32__
@@ -93,17 +90,11 @@ uname (struct utsname *buf)
      For example,
        $ ./uname.exe -s      => MINGW32_NT-5.1
    */
-  if (have_version)
     sprintf (buf->sysname, "MINGW32_%s-%u.%u", super_version,
             (unsigned int) version.dwMajorVersion,
             (unsigned int) version.dwMinorVersion);
-  else
-    strcpy (buf->sysname, "MINGW32");
 #else
-  if (have_version)
     sprintf (buf->sysname, "Windows%s", super_version);
-  else
-    strcpy (buf->sysname, "Windows");
 #endif
 
   /* Fill in release, version.  */
@@ -111,8 +102,6 @@ uname (struct utsname *buf)
        $ ./uname.exe -r      => 1.0.11(0.46/3/2)
        $ ./uname.exe -v      => 2008-08-25 23:40
      There is no point in imitating this behaviour.  */
-  if (have_version)
-    {
       if (version.dwPlatformId == VER_PLATFORM_WIN32_NT)
        {
          /* Windows NT or newer.  */
@@ -160,13 +149,8 @@ uname (struct utsname *buf)
          /* Windows 95/98/ME.  */
          sprintf (buf->release, "Windows %s", super_version);
        }
+
       strcpy (buf->version, version.szCSDVersion);
-    }
-  else
-    {
-      strcpy (buf->release, "Windows");
-      strcpy (buf->version, "");
-    }
 
   /* Fill in machine.  */
   {
@@ -175,7 +159,7 @@ uname (struct utsname *buf)
     GetSystemInfo (&info);
     /* Check for Windows NT, since the info.wProcessorLevel is
        garbage on Windows 95. */
-    if (have_version && version.dwPlatformId == VER_PLATFORM_WIN32_NT)
+    if (version.dwPlatformId == VER_PLATFORM_WIN32_NT)
       {
        /* Windows NT or newer.  */
        switch (info.wProcessorArchitecture)
-- 
1.6.2.5






reply via email to

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