]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Some source code clean up.
authorOliver Kurth <okurth@vmware.com>
Wed, 29 Aug 2018 20:29:45 +0000 (13:29 -0700)
committerOliver Kurth <okurth@vmware.com>
Wed, 29 Aug 2018 20:29:45 +0000 (13:29 -0700)
open-vm-tools/lib/misc/hostinfoInt.h
open-vm-tools/lib/misc/hostinfoPosix.c

index a7d434b4268e784f4228f3c9238ae3827cbdad65..be352e67fc74b45cb7e130de0d8e5f40ffdd7c4a 100644 (file)
@@ -25,7 +25,6 @@
 #ifndef _HOSTINFOINT_H_
 #define _HOSTINFOINT_H_
 
-
 #define MAX_OS_NAME_LEN 128
 #define MAX_OS_FULLNAME_LEN 512
 #define MAX_STRUCTURED_FIELD_LEN 1024
@@ -39,7 +38,7 @@
 
 typedef struct {
    char  *name;
-   char  value[MAX_STRUCTURED_FIELD_LEN];
+   char   value[MAX_STRUCTURED_FIELD_LEN];
 } StructuredField;
 
 /* Must be sorted. Keep in same ordering as structuredFields */
@@ -53,24 +52,23 @@ typedef enum {
    PRETTY_NAME
 } StructuredFieldType;
 
-/* Must be sorted. Keep in same ordering as StructuredFieldType. Defined in
- * hostinfoPosix.c */
+/*
+ * Must be sorted. Keep in same ordering as StructuredFieldType. Defined in
+ * hostinfoPosix.c
+ */
 extern StructuredField structuredFields[];
 
 #define MAX_STRUCTURED_STRING_LEN MAX_STRUCTURED_FIELD_LEN * 10
 
-
 extern volatile Bool HostinfoOSNameCacheValid;
 extern char HostinfoCachedOSName[MAX_OS_NAME_LEN];
 extern char HostinfoCachedOSFullName[MAX_OS_FULLNAME_LEN];
 extern char HostinfoCachedStructuredString[MAX_STRUCTURED_STRING_LEN];
 
-
 /*
  * Global functions
  */
 
 extern Bool HostinfoOSData(void);
 
-
 #endif // ifndef _HOSTINFOINT_H_
index f34c2e0990f2b0391b3b24936a885013316c8735..6dce990bf5d4c7c4e6d133f7395b35576b70ca5f 100644 (file)
        sizeof SYSTEM_BITNESS_64_LINUX))
 
 struct hostinfoOSVersion {
-   int hostinfoOSVersion[4];
+   int   hostinfoOSVersion[4];
    char *hostinfoOSVersionString;
 };
 
@@ -228,14 +228,14 @@ static const DistroInfo distroArray[] = {
 
 /* Must be sorted. Keep in same ordering as StructuredFieldType*/
 StructuredField structuredFields[] = {
-   {"BITNESS", ""},         // "32" or "64"
-   {"BUILD_NUMBER", ""},    // Always present for MacOS. Present for some Linux distros.
-   {"DISTRO_NAME", ""},     // Defaults to uname -s
-   {"DISTRO_VERSION", ""},  // Always present for MacOS. Read from distro files for Linux.
-   {"FAMILY_NAME", ""},     // Defaults to uname -s
-   {"KERNEL_VERSION", ""},  // Defaults to uname -r
-   {"PRETTY_NAME", ""},     // Always present for MacOS. Read from distro files for Linux.
-   {NULL},
+   { "bitness",       "" },  // "32" or "64"
+   { "buildNumber",   "" },  // Always present for MacOS. Present for some Linux distros.
+   { "distroName",    "" },  // Defaults to uname -s
+   { "distroVersion", "" },  // Always present for MacOS. Read from distro files for Linux.
+   { "familyName",    "" },  // Defaults to uname -s
+   { "kernelVersion", "" },  // Defaults to uname -r
+   { "prettyName",    "" },  // Always present for MacOS. Read from distro files for Linux.
+   { NULL,            "" },  // MUST BE LAST
 };
 
 #if defined __ANDROID__
@@ -559,7 +559,7 @@ HostinfoOSStructuredString(void)
           sizeof HostinfoCachedStructuredString);
 
    for (field = structuredFields; field->name != NULL; field++) {
-      if (field->value != NULL && *field->value != '\0') {
+      if (field->value[0] != '\0') {
          /* Account for escape char and null char */
          char escapedString[MAX_STRUCTURED_FIELD_LEN * 2 + 1];
          char fieldString[MAX_STRUCTURED_FIELD_LEN];
@@ -598,7 +598,8 @@ HostinfoOSStructuredString(void)
          }
       }
    }
-   Log("structuredstring = \"%s\"\n", HostinfoCachedStructuredString);
+
+   Log("structured string = \"%s\"\n", HostinfoCachedStructuredString);
 }