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
rgw: conform to the standard usage of string::find #10086
Conversation
int eqpos = param.find('='); | ||
if (eqpos > 0) { | ||
size_t eqpos = param.find('='); | ||
if (eqpos != string::npos) { | ||
string param_name = rgw_trim_whitespace(param.substr(0, eqpos)); | ||
string val = rgw_trim_quotes(param.substr(eqpos + 1)); |
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.
don't need val; avoid a possible copy
@Yan-waller one nit found (ideas on improving the clarity of this sort of code would be welcome:) |
9d4496e
to
fa635c4
Compare
Signed-off-by: Yan Jun <yan.jun8@zte.com.cn>
@mattbenjamin thanks, I have fixed it and kill some compiling warnings. |
retest this please |
lgtm |
string param_name = rgw_trim_whitespace(param.substr(0, eqpos)); | ||
string val = rgw_trim_quotes(param.substr(eqpos + 1)); | ||
params[param_name] = val; | ||
size_t eqpos = param.find('='); |
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.
can see why the original made steps explicit; this is smaller but has the same effect, iiuc
Signed-off-by: Yan Jun yan.jun8@zte.com.cn