]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
It's more readable and friendly to use the enum value instead of number.
authorWeng Meiling <wengmeiling.weng@huawei.com>
Tue, 23 Jul 2013 12:58:20 +0000 (14:58 +0200)
committerWeng Meiling <wengmeiling.weng@huawei.com>
Tue, 23 Jul 2013 12:58:20 +0000 (14:58 +0200)
Signed-off-by: Weng Meiling <wengmeiling.weng@huawei.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
src/tools/cgget.c

index 49a447c6cb0477c2b30e493fe539ed71a30b1a47..e1e1d60d115d04ce629f9475a6abb5541e6b042c 100644 (file)
@@ -361,22 +361,22 @@ int main(int argc, char *argv[])
                case 'g':
                        if (strchr(optarg, ':') == NULL) {
                                /* -g <group> */
-                               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 <group>:<path> */
-                               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 <controllers>:<path> and <path> or path not set */
                usage(1, argv[0]);
                result = -1;