From: Weng Meiling <wengmeiling.w...@huawei.com>

It's more readable and friendly to use the enum value
instead of number.

Signed-off-by:Weng Meiling <wengmeiling.w...@huawei.com>
---
 src/tools/cgget.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/tools/cgget.c b/src/tools/cgget.c
index 49a447c..e1e1d60 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 <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;
-- 
1.8.2.2



------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to