MEDIUM: sample: pass an empty list instead of a null for fetch args
ACL and sample fetches use args list and it is really not convenient to
check for null args everywhere. Now for empty args we pass a constant
list of end of lists. It will allow us to remove many useless checks.
diff --git a/src/arg.c b/src/arg.c
index 187540d..f113ba3 100644
--- a/src/arg.c
+++ b/src/arg.c
@@ -36,6 +36,11 @@
/* Unassigned types must never happen. Better crash during parsing if they do. */
};
+/* This dummy arg list may be used by default when no arg is found, it helps
+ * parsers by removing pointer checks.
+ */
+struct arg empty_arg_list[8] = { };
+
/* This function builds an argument list from a config line. It returns the
* number of arguments found, or <0 in case of any error. Everything needed
* it automatically allocated. A pointer to an error message might be returned