]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: Cleanup return codes to use enum values
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 27 Aug 2019 11:45:02 +0000 (07:45 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 3 Sep 2019 12:19:22 +0000 (08:19 -0400)
A couple functions in routemap.c were returning
0/1 that were being mapped into the appropriate
enum values on the calling functions to check return
values.  This matches the return values to the actual
enum for future readability.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib/routemap.c

index eca02e8366779b4ac8fb710de7cda7d20631f574..c57415303f046bf997e00f9ea5d178edca4be884 100644 (file)
@@ -1472,7 +1472,7 @@ int route_map_delete_match(struct route_map_index *index,
 
        cmd = route_map_lookup_match(match_name);
        if (cmd == NULL)
-               return 1;
+               return RMAP_RULE_MISSING;
 
        for (rule = index->match_list.head; rule; rule = rule->next)
                if (rule->cmd == cmd && (rulecmp(rule->rule_str, match_arg) == 0
@@ -1485,10 +1485,10 @@ int route_map_delete_match(struct route_map_index *index,
                                        index->map->name,
                                        RMAP_EVENT_CALL_ADDED);
                        }
-                       return 0;
+                       return RMAP_COMPILE_SUCCESS;
                }
        /* Can't find matched rule. */
-       return 1;
+       return RMAP_RULE_MISSING;
 }
 
 /* Add route-map set statement to the route map. */
@@ -1551,7 +1551,7 @@ int route_map_delete_set(struct route_map_index *index, const char *set_name,
 
        cmd = route_map_lookup_set(set_name);
        if (cmd == NULL)
-               return 1;
+               return RMAP_RULE_MISSING;
 
        for (rule = index->set_list.head; rule; rule = rule->next)
                if ((rule->cmd == cmd) && (rulecmp(rule->rule_str, set_arg) == 0
@@ -1564,10 +1564,10 @@ int route_map_delete_set(struct route_map_index *index, const char *set_name,
                                        index->map->name,
                                        RMAP_EVENT_CALL_ADDED);
                        }
-                       return 0;
+                       return RMAP_COMPILE_SUCCESS;
                }
        /* Can't find matched rule. */
-       return 1;
+       return RMAP_RULE_MISSING;
 }
 
 static enum route_map_cmd_result_t