Skip to content

Commit

Permalink
quota root default init changed to use common param parse function
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey-Kitov authored and villesavolainen committed Jun 14, 2017
1 parent 2632790 commit 70d7819
Showing 1 changed file with 8 additions and 23 deletions.
31 changes: 8 additions & 23 deletions src/plugins/quota/quota.c
Expand Up @@ -376,29 +376,14 @@ static void quota_root_deinit(struct quota_root *root)
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
Expand Down

0 comments on commit 70d7819

Please sign in to comment.