[PATCHv2 2/2] sysinfo: delete unnecessary white space of sysinfo.

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

 



sysinfo: delete unnecessary white space of sysinfo.

  * Trim each element and delete null entry of sysinfo by virSkipSpacesBackwards().

Signed-off-by: Minoru Usui <usui@xxxxxxxxxxxxxxxxx>
---
 src/util/sysinfo.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/src/util/sysinfo.c b/src/util/sysinfo.c
index a6e525b..d84b973 100644
--- a/src/util/sysinfo.c
+++ b/src/util/sysinfo.c
@@ -246,6 +246,7 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
         if ((cur = strstr(base, "Socket Designation: ")) != NULL) {
             cur += 20;
             eol = strchr(cur, '\n');
+            virSkipSpacesBackwards(cur, &eol);
             if ((eol) &&
                 ((processor->processor_socket_destination = strndup(cur, eol - cur)) == NULL))
                 goto no_memory;
@@ -253,6 +254,7 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
         if ((cur = strstr(base, "Type: ")) != NULL) {
             cur += 6;
             eol = strchr(cur, '\n');
+            virSkipSpacesBackwards(cur, &eol);
             if ((eol) &&
                 ((processor->processor_type = strndup(cur, eol - cur)) == NULL))
                 goto no_memory;
@@ -260,6 +262,7 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
         if ((cur = strstr(base, "Family: ")) != NULL) {
             cur += 8;
             eol = strchr(cur, '\n');
+            virSkipSpacesBackwards(cur, &eol);
             if ((eol) &&
                 ((processor->processor_family = strndup(cur, eol - cur)) == NULL))
                 goto no_memory;
@@ -267,6 +270,7 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
         if ((cur = strstr(base, "Manufacturer: ")) != NULL) {
             cur += 14;
             eol = strchr(cur, '\n');
+            virSkipSpacesBackwards(cur, &eol);
             if ((eol) &&
                 ((processor->processor_manufacturer = strndup(cur, eol - cur)) == NULL))
                 goto no_memory;
@@ -274,6 +278,7 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
         if ((cur = strstr(base, "Signature: ")) != NULL) {
             cur += 11;
             eol = strchr(cur, '\n');
+            virSkipSpacesBackwards(cur, &eol);
             if ((eol) &&
                 ((processor->processor_signature = strndup(cur, eol - cur)) == NULL))
                 goto no_memory;
@@ -281,6 +286,7 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
         if ((cur = strstr(base, "Version: ")) != NULL) {
             cur += 9;
             eol = strchr(cur, '\n');
+            virSkipSpacesBackwards(cur, &eol);
             if ((eol) &&
                 ((processor->processor_version = strndup(cur, eol - cur)) == NULL))
                 goto no_memory;
@@ -288,6 +294,7 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
         if ((cur = strstr(base, "External Clock: ")) != NULL) {
             cur += 16;
             eol = strchr(cur, '\n');
+            virSkipSpacesBackwards(cur, &eol);
             if ((eol) &&
                 ((processor->processor_external_clock = strndup(cur, eol - cur)) == NULL))
                 goto no_memory;
@@ -295,6 +302,7 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
         if ((cur = strstr(base, "Max Speed: ")) != NULL) {
             cur += 11;
             eol = strchr(cur, '\n');
+            virSkipSpacesBackwards(cur, &eol);
             if ((eol) &&
                 ((processor->processor_max_speed = strndup(cur, eol - cur)) == NULL))
                 goto no_memory;
@@ -302,6 +310,7 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
         if ((cur = strstr(base, "Status: ")) != NULL) {
             cur += 8;
             eol = strchr(cur, '\n');
+            virSkipSpacesBackwards(cur, &eol);
             if ((eol) &&
                 ((processor->processor_status = strndup(cur, eol - cur)) == NULL))
                 goto no_memory;
@@ -309,6 +318,7 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
         if ((cur = strstr(base, "Serial Number: ")) != NULL) {
             cur += 15;
             eol = strchr(cur, '\n');
+            virSkipSpacesBackwards(cur, &eol);
             if ((eol) &&
                 ((processor->processor_serial_number = strndup(cur, eol - cur)) == NULL))
                 goto no_memory;
@@ -316,6 +326,7 @@ virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
         if ((cur = strstr(base, "Part Number: ")) != NULL) {
             cur += 13;
             eol = strchr(cur, '\n');
+            virSkipSpacesBackwards(cur, &eol);
             if ((eol) &&
                 ((processor->processor_part_number = strndup(cur, eol - cur)) == NULL))
                 goto no_memory;
@@ -351,6 +362,7 @@ virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
             if (STREQLEN(cur, "No Module Installed", eol - cur))
                 goto next;
 
+            virSkipSpacesBackwards(cur, &eol);
             if ((eol) &&
                 ((memory->memory_size = strndup(cur, eol - cur)) == NULL))
                 goto no_memory;
@@ -358,6 +370,7 @@ virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
         if ((cur = strstr(base, "Form Factor: ")) != NULL) {
             cur += 13;
             eol = strchr(cur, '\n');
+            virSkipSpacesBackwards(cur, &eol);
             if ((eol) &&
                 ((memory->memory_form_factor = strndup(cur, eol - cur)) == NULL))
                 goto no_memory;
@@ -365,6 +378,7 @@ virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
         if ((cur = strstr(base, "Locator: ")) != NULL) {
             cur += 9;
             eol = strchr(cur, '\n');
+            virSkipSpacesBackwards(cur, &eol);
             if ((eol) &&
                 ((memory->memory_locator = strndup(cur, eol - cur)) == NULL))
                 goto no_memory;
@@ -372,6 +386,7 @@ virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
         if ((cur = strstr(base, "Bank Locator: ")) != NULL) {
             cur += 14;
             eol = strchr(cur, '\n');
+            virSkipSpacesBackwards(cur, &eol);
             if ((eol) &&
                 ((memory->memory_bank_locator = strndup(cur, eol - cur)) == NULL))
                 goto no_memory;
@@ -379,6 +394,7 @@ virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
         if ((cur = strstr(base, "Type: ")) != NULL) {
             cur += 6;
             eol = strchr(cur, '\n');
+            virSkipSpacesBackwards(cur, &eol);
             if ((eol) &&
                 ((memory->memory_type = strndup(cur, eol - cur)) == NULL))
                 goto no_memory;
@@ -386,6 +402,7 @@ virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
         if ((cur = strstr(base, "Type Detail: ")) != NULL) {
             cur += 13;
             eol = strchr(cur, '\n');
+            virSkipSpacesBackwards(cur, &eol);
             if ((eol) &&
                 ((memory->memory_type_detail = strndup(cur, eol - cur)) == NULL))
                 goto no_memory;
@@ -393,6 +410,7 @@ virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
         if ((cur = strstr(base, "Speed: ")) != NULL) {
             cur += 7;
             eol = strchr(cur, '\n');
+            virSkipSpacesBackwards(cur, &eol);
             if ((eol) &&
                 ((memory->memory_speed = strndup(cur, eol - cur)) == NULL))
                 goto no_memory;
@@ -400,6 +418,7 @@ virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
         if ((cur = strstr(base, "Manufacturer: ")) != NULL) {
             cur += 14;
             eol = strchr(cur, '\n');
+            virSkipSpacesBackwards(cur, &eol);
             if ((eol) &&
                 ((memory->memory_manufacturer = strndup(cur, eol - cur)) == NULL))
                 goto no_memory;
@@ -407,6 +426,7 @@ virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
         if ((cur = strstr(base, "Serial Number: ")) != NULL) {
             cur += 15;
             eol = strchr(cur, '\n');
+            virSkipSpacesBackwards(cur, &eol);
             if ((eol) &&
                 ((memory->memory_serial_number = strndup(cur, eol - cur)) == NULL))
                 goto no_memory;
@@ -414,6 +434,7 @@ virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
         if ((cur = strstr(base, "Part Number: ")) != NULL) {
             cur += 13;
             eol = strchr(cur, '\n');
+            virSkipSpacesBackwards(cur, &eol);
             if ((eol) &&
                 ((memory->memory_part_number = strndup(cur, eol - cur)) == NULL))
                 goto no_memory;
-- 
1.7.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]