]> diplodocus.org Git - nmh/commitdiff
icalparse.y: Remove else-block that returns by merging if-conditions.
authorRalph Corderoy <ralph@inputplus.co.uk>
Sat, 9 Sep 2017 20:30:39 +0000 (21:30 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Sat, 9 Sep 2017 20:30:39 +0000 (21:30 +0100)
The code tested two values to see if they were present, and if they
were, and were equal, then it returned this node.  If either were
missing then this node was still returned because it matched the more
limited criteria that had already been tested.  So the test for
returning this node can more simply be if either value to compare is
missing, or they're (both present and) equal.

sbr/icalparse.y

index 88edb0c83eb66a05f996b511be45abb89d9fb1f1..f2fcc0ea863b998ff5dadc5a47b27c96c9156b04 100644 (file)
@@ -176,13 +176,8 @@ find_contentline (contentline *contentlines, const char *name,
     for (node = contentlines; node; node = node->next) {
         /* node->name will be NULL if the line was "deleted". */
         if (node->name  &&  ! strcasecmp (name, node->name)) {
     for (node = contentlines; node; node = node->next) {
         /* node->name will be NULL if the line was "deleted". */
         if (node->name  &&  ! strcasecmp (name, node->name)) {
-            if (val  &&  node->value) {
-                if (! strcasecmp (val, node->value)) {
-                    return node;
-                }
-            } else {
+            if (!val || !node->value || !strcasecmp(val, node->value))
                 return node;
                 return node;
-            }
         }
     }
 
         }
     }