File 0219-btrfs-progs-cleanup-avoid-to-use-literal-for-getopt-.patch of Package btrfsprogs.356
From 0e4e1b1ed92bb687bd5a7decc3b54118b6cf401b Mon Sep 17 00:00:00 2001
From: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Date: Fri, 19 Dec 2014 14:31:54 +0900
Subject: [PATCH 219/303] btrfs-progs: cleanup: avoid to use literal for getopt
val
Signed-off-by: David Sterba <dsterba@suse.cz>
---
cmds-fi-disk_usage.c | 8 ++++----
cmds-filesystem.c | 8 ++++----
utils.h | 3 +++
3 files changed, 11 insertions(+), 8 deletions(-)
Index: btrfs-progs-v3.16.2/cmds-fi-disk_usage.c
===================================================================
--- btrfs-progs-v3.16.2.orig/cmds-fi-disk_usage.c
+++ btrfs-progs-v3.16.2/cmds-fi-disk_usage.c
@@ -877,8 +877,8 @@ int cmd_filesystem_usage(int argc, char
{ "mbytes", no_argument, NULL, 'm'},
{ "gbytes", no_argument, NULL, 'g'},
{ "tbytes", no_argument, NULL, 't'},
- { "si", no_argument, NULL, 256},
- { "iec", no_argument, NULL, 257},
+ { "si", no_argument, NULL, GETOPT_VAL_SI},
+ { "iec", no_argument, NULL, GETOPT_VAL_IEC},
};
int c = getopt_long(argc, argv, "bhHkmgtT", long_options,
&long_index);
@@ -907,10 +907,10 @@ int cmd_filesystem_usage(int argc, char
case 'H':
unit_mode = UNITS_HUMAN_DECIMAL;
break;
- case 256:
+ case GETOPT_VAL_SI:
units_set_mode(&unit_mode, UNITS_DECIMAL);
break;
- case 257:
+ case GETOPT_VAL_IEC:
units_set_mode(&unit_mode, UNITS_BINARY);
break;
case 'T':
Index: btrfs-progs-v3.16.2/cmds-filesystem.c
===================================================================
--- btrfs-progs-v3.16.2.orig/cmds-filesystem.c
+++ btrfs-progs-v3.16.2/cmds-filesystem.c
@@ -207,8 +207,8 @@ static int cmd_filesystem_df(int argc, c
{ "mbytes", no_argument, NULL, 'm'},
{ "gbytes", no_argument, NULL, 'g'},
{ "tbytes", no_argument, NULL, 't'},
- { "si", no_argument, NULL, 256},
- { "iec", no_argument, NULL, 257},
+ { "si", no_argument, NULL, GETOPT_VAL_SI},
+ { "iec", no_argument, NULL, GETOPT_VAL_IEC},
};
int c = getopt_long(argc, argv, "bhHkmgt", long_options,
&long_index);
@@ -236,10 +236,10 @@ static int cmd_filesystem_df(int argc, c
case 'H':
unit_mode = UNITS_HUMAN_DECIMAL;
break;
- case 256:
+ case GETOPT_VAL_SI:
units_set_mode(&unit_mode, UNITS_DECIMAL);
break;
- case 257:
+ case GETOPT_VAL_IEC:
units_set_mode(&unit_mode, UNITS_BINARY);
break;
default:
Index: btrfs-progs-v3.16.2/utils.h
===================================================================
--- btrfs-progs-v3.16.2.orig/utils.h
+++ btrfs-progs-v3.16.2/utils.h
@@ -42,6 +42,9 @@
#define ARGV0_BUF_SIZE 64
+#define GETOPT_VAL_SI 256
+#define GETOPT_VAL_IEC 257
+
int check_argc_exact(int nargs, int expected);
int check_argc_min(int nargs, int expected);
int check_argc_max(int nargs, int expected);