]> xenbits.xensource.com Git - libvirt.git/commitdiff
xm_internal.c: remove four useless comparisons after strchr
authorJim Meyering <meyering@redhat.com>
Mon, 7 Sep 2009 08:09:20 +0000 (10:09 +0200)
committerJim Meyering <meyering@redhat.com>
Mon, 7 Sep 2009 16:14:41 +0000 (18:14 +0200)
* src/xm_internal.c (xenXMDomainConfigParse): After t=strchr...
don't test *t; it's known.  This was *not* detected by clang,
but I spotted it since once instance was in the vicinity of the
dead increment of "data".

src/xm_internal.c

index 5b2b0aa51ba40a7aedf4750694268edc3f1a2e65..de3aca9e9d4e4a4e2fb6b7edd1acf8d543fc749d 100644 (file)
@@ -862,7 +862,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
              */
 
             /* Extract the source file path*/
-            if (!(offset = strchr(head, ',')) || offset[0] == '\0')
+            if (!(offset = strchr(head, ',')))
                 goto skipdisk;
             if ((offset - head) >= (PATH_MAX-1))
                 goto skipdisk;
@@ -882,7 +882,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
                 head = head + 6;
 
             /* Extract the dest device name */
-            if (!(offset = strchr(head, ',')) || offset[0] == '\0')
+            if (!(offset = strchr(head, ',')))
                 goto skipdisk;
             if (VIR_ALLOC_N(disk->dst, (offset - head) + 1) < 0)
                 goto no_memory;
@@ -1018,7 +1018,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
                 char *data;
                 char *nextkey = strchr(key, ',');
 
-                if (!(data = strchr(key, '=')) || (data[0] == '\0'))
+                if (!(data = strchr(key, '=')))
                     goto skipnic;
                 data++;
 
@@ -1312,7 +1312,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
                     nextkey++;
                 }
 
-                if (!(data = strchr(key, '=')) || (data[0] == '\0'))
+                if (!(data = strchr(key, '=')))
                     break;
 
                 if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {