printing: Save a few lines with str_list_add_printf()
authorVolker Lendecke <vl@samba.org>
Wed, 12 Jan 2022 11:09:51 +0000 (12:09 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 18 Jan 2022 20:22:38 +0000 (20:22 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/printing/print_svid.c

index d20fdad88e34dd7e2ed477fb0da3282f2cf285fc..4006323c051bd3c177f04ee39f2bea44a650ea23 100644 (file)
@@ -49,21 +49,12 @@ bool sysv_cache_reload(struct pcap_cache **_pcache)
        DEBUG(5, ("reloading sysv printcap cache\n"));
 #endif
 
-       argl = talloc_zero_array(talloc_tos(), char *, 3);
+       argl = str_list_make_empty(talloc_tos());
+       str_list_add_printf(&argl, "/usr/bin/lpstat");
+       str_list_add_printf(&argl, "-v");
        if (argl == NULL) {
                return false;
        }
-       argl[0] = talloc_strdup(argl, "/usr/bin/lpstat");
-       if (argl[0] == NULL) {
-               TALLOC_FREE(argl);
-               return false;
-       }
-       argl[1] = talloc_strdup(argl, "-v");
-       if (argl[1] == NULL) {
-               TALLOC_FREE(argl);
-               return false;
-       }
-       argl[2] = NULL;
 
        lines = file_lines_ploadv(talloc_tos(), argl, NULL);
        if (lines == NULL) {