-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove the redundant check in dmalloc_argv.c #69
base: master
Are you sure you want to change the base?
Conversation
The same condition check either before or after Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Change-Id: I4a68b9550b6486f8dffde3962d9997262cdd1622
@@ -820,10 +820,7 @@ static void usage_long(const argv_t *args) | |||
col_c++; | |||
} | |||
else { | |||
if (arg_p->ar_short_arg == '\0') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes the logic here right? If it is \0 then it's going to call into the else block below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 818 already check '\0'
@@ -2223,12 +2215,6 @@ static void do_arg(argv_t *grid, argv_t *match_p, const char *close_p, | |||
*okay_bp = ARGV_FALSE; | |||
} | |||
} | |||
else if (argv_close_enable_b && close_p != NULL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this removed? Was in unreachable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, because line 2214/2206 already check it.
@@ -2412,8 +2398,7 @@ static void do_list(argv_t *grid, const int arg_c, char **argv, | |||
} | |||
|
|||
/* check for special usage value */ | |||
if (strncmp(USAGE_ARG, *arg_p + LONG_PREFIX_LENGTH, len) == 0 | |||
|| strncmp(HELP_ARG, *arg_p + LONG_PREFIX_LENGTH, len) == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was the HELP_ARG support removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it block line 2452/2437 I suppose it should print argv_help_string in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah can we revert this? They are printing different information. This is printing the usage message while below brings the help line. I want --usage and --help to display the usage strong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, you prefer to remove?
https://github.com/j256/dmalloc/pull/69/files#diff-324a2b5ba7c2f719c853831ed17df55f8ce68bf781d2c4ae98734f29946b575bR2437-R2453
and argv_help_string(no other place reference it) since it's impossible to enter that branch.
The same condition check either before or after