MINOR: action: Use a generic function to check validity of an action rule list

The check_action_rules() function is now used to check the validity of an
action rule list. It is used from check_config_validity() function to check
L5/6/7 rulesets.
diff --git a/src/action.c b/src/action.c
index 29eae81..7b017f6 100644
--- a/src/action.c
+++ b/src/action.c
@@ -23,6 +23,28 @@
 #include <haproxy/tools.h>
 
 
+/* Check an action ruleset validity. It returns the number of error encountered
+ * andd err_code is updated if a warning is emitted.
+ */
+int check_action_rules(struct list *rules, struct proxy *px, int *err_code)
+{
+	struct act_rule *rule;
+	char *errmsg = NULL;
+	int err = 0;
+
+	list_for_each_entry(rule, rules, list) {
+		if (rule->check_ptr && !rule->check_ptr(rule, px, &errmsg)) {
+			ha_alert("Proxy '%s': %s.\n", px->id, errmsg);
+			err++;
+		}
+
+		free(errmsg);
+		errmsg = NULL;
+	}
+
+	return err;
+}
+
 /* Find and check the target table used by an action track-sc*. This
  * function should be called during the configuration validity check.
  *