]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
rfkill: fix coding style and error messages
authorKarel Zak <kzak@redhat.com>
Fri, 15 Sep 2017 10:28:44 +0000 (12:28 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 15 Sep 2017 10:28:44 +0000 (12:28 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/rfkill.c

index 7914c4309340c5b8a30e92064bfe620736d32e02..1379b6b6fd7421a910411d53fd62cb0fb2e7eece 100644 (file)
@@ -311,7 +311,10 @@ static void fill_table_row(struct libscols_table *tb, struct rfkill_event *event
 
 static void rfkill_list_init(struct control *ctrl)
 {
+       size_t i;
+
        scols_init_debug(0);
+
        ctrl->tb = scols_new_table();
        if (!ctrl->tb)
                err(EXIT_FAILURE, _("failed to allocate output table"));
@@ -319,15 +322,12 @@ static void rfkill_list_init(struct control *ctrl)
        scols_table_enable_json(ctrl->tb, ctrl->json);
        scols_table_enable_noheadings(ctrl->tb, ctrl->no_headings);
        scols_table_enable_raw(ctrl->tb, ctrl->raw);
-       {
-               size_t i;
 
-               for (i = 0; i < (size_t)ncolumns; i++) {
-                       const struct colinfo *col = get_column_info(i);
+       for (i = 0; i < (size_t) ncolumns; i++) {
+               const struct colinfo *col = get_column_info(i);
 
-                       if (!scols_table_new_column(ctrl->tb, col->name, col->whint, col->flags))
-                               err(EXIT_FAILURE, _("failed to initialize output column"));
-               }
+               if (!scols_table_new_column(ctrl->tb, col->name, col->whint, col->flags))
+                       err(EXIT_FAILURE, _("failed to allocate output column"));
        }
 }