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

nv_addtype() is never called with optstr set to NULL #1410

Closed
krader1961 opened this issue Oct 3, 2019 · 1 comment
Closed

nv_addtype() is never called with optstr set to NULL #1410

krader1961 opened this issue Oct 3, 2019 · 1 comment
Assignees
Labels

Comments

@krader1961
Copy link
Contributor

While working on issue #507 I noticed that nv_addtype() is only called from two places and neither passes a NULL pointer for the optstr parameter. So this block of code is bogus:

if (optstr) {
cp->optstring = optstr;
} else {
cp->optstring = sh_opttype;
}

The condition is always true, thus the else block will never be executed. This is also true in the ksh93u+ branch (ast.master) which includes one other call site that has since been removed.

@krader1961 krader1961 self-assigned this Oct 3, 2019
@krader1961
Copy link
Contributor Author

This is, in one sense, a trivial issue. Perhaps there was a time long ago (> 7 years) in a pre-ksh93u+ release where nv_addtype() was called with optstr == NULL (but I suspect that is not true). I opened this issue because I want to communicate to other people interested in this project that cleaning up cruft is a worthy goal in its own right. Every time irrelevant code is deleted or simplified the overall code quality is improved.

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

No branches or pull requests

1 participant