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

loader: Do not repeat strlen(options) condition #620

Merged
merged 1 commit into from
Dec 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions lib/loader/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,16 +267,15 @@ struct evmc_vm* evmc_load_and_configure(const char* config, enum evmc_loader_err
if (!vm)
return NULL;

if (vm->set_option == NULL && strlen(options) != 0)
{
ec = set_error(EVMC_LOADER_INVALID_OPTION_NAME, "%s (%s) does not support any options",
vm->name, path);
goto exit;
}


while (strlen(options) != 0)
{
if (vm->set_option == NULL)
{
ec = set_error(EVMC_LOADER_INVALID_OPTION_NAME, "%s (%s) does not support any options",
vm->name, path);
goto exit;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be break; now, but maybe keeping goto is fine for consistency.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use goto exit because the later switch is also using it in case of error.

}

char* option = get_token(&options, ',');

// Slit option into name and value by taking the name token.
Expand Down