Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xiaoxiang781216
Copy link
Contributor

The same condition check either before or after

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') {
Copy link
Owner

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.

Copy link
Contributor Author

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) {
Copy link
Owner

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?

Copy link
Contributor Author

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) {
Copy link
Owner

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?

Copy link
Contributor Author

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.

Copy link
Owner

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.

Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants