From: Weng Meiling Date: Tue, 23 Jul 2013 12:58:20 +0000 (+0200) Subject: It's more readable and friendly to use the enum value instead of number. X-Git-Tag: v0.41~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd46707268c392a3bdc7de833a91915199adb14e;p=thirdparty%2Flibcgroup.git It's more readable and friendly to use the enum value instead of number. Signed-off-by: Weng Meiling Acked-by: Ivana Hutarova Varekova --- diff --git a/src/tools/cgget.c b/src/tools/cgget.c index 49a447c6..e1e1d60d 100644 --- a/src/tools/cgget.c +++ b/src/tools/cgget.c @@ -361,22 +361,22 @@ int main(int argc, char *argv[]) case 'g': if (strchr(optarg, ':') == NULL) { /* -g */ - if (group_needed == 2) { + if (group_needed == GR_LIST) { usage(1, argv[0]); result = -1; goto err; } - group_needed = 1; + group_needed = GR_GROUP; add_record_to_buffer(controllers, optarg, capacity); } else { /* -g : */ - if (group_needed == 1) { + if (group_needed == GR_GROUP) { usage(1, argv[0]); result = -1; goto err; } - group_needed = 2; + group_needed = GR_LIST; ret = parse_cgroup_spec(cgroup_list, optarg, capacity); if (ret) { @@ -389,12 +389,12 @@ int main(int argc, char *argv[]) } break; case 'a': - if (group_needed == 2) { + if (group_needed == GR_LIST) { usage(1, argv[0]); result = -1; goto err; } - group_needed = 1; + group_needed = GR_GROUP; /* go through cgroups for all possible controllers */ mode |= MODE_SHOW_ALL_CONTROLLERS; break; @@ -405,8 +405,8 @@ int main(int argc, char *argv[]) } } - if (((group_needed == 2) && (argv[optind])) || - ((group_needed != 2) && (!argv[optind]))) { + if (((group_needed == GR_LIST) && (argv[optind])) || + ((group_needed != GR_LIST) && (!argv[optind]))) { /* mixed -g : and or path not set */ usage(1, argv[0]); result = -1;