]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
prlimit: clean up scols usage
authorKarel Zak <kzak@redhat.com>
Thu, 3 Apr 2014 08:53:03 +0000 (10:53 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 3 Apr 2014 10:29:20 +0000 (12:29 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/prlimit.c

index 4e0cc5eda0086a0a9876452ef60be5b3588ed2ce..9b1b85f65be5fbefc5dc4f5d3cc43c794a54b375 100644 (file)
@@ -221,10 +221,8 @@ static void add_scols_line(struct libscols_table *table, struct prlimit *l)
        assert(l);
 
        line = scols_table_new_line(table, NULL);
-       if (!line) {
-               warn(_("failed to add line to output"));
-               return;
-       }
+       if (!line)
+               err(EXIT_FAILURE, _("failed to initialize output line"));
 
        for (i = 0; i < ncolumns; i++) {
                char *str = NULL;
@@ -256,7 +254,7 @@ static void add_scols_line(struct libscols_table *table, struct prlimit *l)
                }
 
                if (str)
-                       scols_line_set_data(line, i, str);
+                       scols_line_refer_data(line, i, str);
        }
 }
 
@@ -291,20 +289,17 @@ static int show_limits(struct list_head *lims)
        struct libscols_table *table;
 
        table = scols_new_table(NULL);
-       if (!table) {
-               warn(_("failed to initialize output table"));
-               return -1;
-       }
+       if (!table)
+               err(EXIT_FAILURE, _("failed to initialize output table"));
+
        scols_table_set_raw(table, raw);
        scols_table_set_no_headings(table, no_headings);
 
        for (i = 0; i < ncolumns; i++) {
                struct colinfo *col = get_column_info(i);
 
-               if (!scols_table_new_column(table, col->name, col->whint, col->flags)) {
-                       warnx(_("failed to initialize output column"));
-                       goto done;
-               }
+               if (!scols_table_new_column(table, col->name, col->whint, col->flags))
+                       err(EXIT_FAILURE, _("failed to initialize output column"));
        }
 
 
@@ -316,7 +311,6 @@ static int show_limits(struct list_head *lims)
        }
 
        scols_print_table(table);
-done:
        scols_unref_table(table);
        return 0;
 }