From: Volker Lendecke Date: Wed, 12 Jan 2022 11:15:08 +0000 (+0100) Subject: lib: Save a few lines with str_list_add_printf() X-Git-Tag: tdb-1.4.6~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ef5d1d4e5653687805cc1d5811327ab99d1357b;p=thirdparty%2Fsamba.git lib: Save a few lines with str_list_add_printf() Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/lib/sysquotas.c b/source3/lib/sysquotas.c index 6553cac40da..14c07a26f4e 100644 --- a/source3/lib/sysquotas.c +++ b/source3/lib/sysquotas.c @@ -272,31 +272,14 @@ static int command_get_quota(const char *path, enum SMB_QUOTA_TYPE qtype, unid_t return -1; } - argl = talloc_zero_array(talloc_tos(), char *, 5); + argl = str_list_make_empty(talloc_tos()); + str_list_add_printf(&argl, "%s", get_quota_command); + str_list_add_printf(&argl, "%s", path); + str_list_add_printf(&argl, "%d", qtype); + str_list_add_printf(&argl, "%d", _id); if (argl == NULL) { return -1; } - argl[0] = talloc_strdup(argl, get_quota_command); - if (argl[0] == NULL) { - TALLOC_FREE(argl); - return -1; - } - argl[1] = talloc_strdup(argl, path); - if (argl[1] == NULL) { - TALLOC_FREE(argl); - return -1; - } - argl[2] = talloc_asprintf(argl, "%d", qtype); - if (argl[2] == NULL) { - TALLOC_FREE(argl); - return -1; - } - argl[3] = talloc_asprintf(argl, "%d", _id); - if (argl[3] == NULL) { - TALLOC_FREE(argl); - return -1; - } - argl[4] = NULL; DBG_NOTICE("Running command %s %s %d %d\n", get_quota_command,