changeset 22203:01abf99c7876

quota root default init changed to use common param parse function
author Sergey Kitov <sergey.kitov@open-xchange.com>
date Fri, 19 May 2017 10:46:27 +0300
parents 23f6dcef10c4
children 3b85ccb26ac3
files src/plugins/quota/quota.c
diffstat 1 files changed, 8 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/quota/quota.c	Thu May 18 13:30:25 2017 +0300
+++ b/src/plugins/quota/quota.c	Fri May 19 10:46:27 2017 +0300
@@ -376,29 +376,14 @@
 int quota_root_default_init(struct quota_root *root, const char *args,
 			    const char **error_r)
 {
-	const char *const *tmp;
-
-	if (args == NULL)
-		return 0;
-
-	tmp = t_strsplit_spaces(args, " ");
-	for (; *tmp != NULL; tmp++) {
-		if (strcmp(*tmp, "noenforcing") == 0)
-			root->no_enforcing = TRUE;
-		else if (strcmp(*tmp, "hidden") == 0)
-			root->hidden = TRUE;
-		else if (strcmp(*tmp, "ignoreunlimited") == 0)
-			root->disable_unlimited_tracking = TRUE;
-		else
-			break;
-	}
-	if (*tmp != NULL) {
-		*error_r = t_strdup_printf(
-			"Unknown parameter for backend %s: %s",
-			root->backend.name, *tmp);
-		return -1;
-	}
-	return 0;
+	const struct quota_param_parser default_params[] = {
+		quota_param_hidden,
+		quota_param_ignoreunlimited,
+		quota_param_noenforcing,
+		quota_param_ns,
+		{.param_name = NULL}
+	};
+	return quota_parse_parameters(root, &args, error_r, default_params, FALSE);
 }
 
 static int