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

rgw: conform to the standard usage of string::find #10086

Merged
merged 1 commit into from Dec 1, 2016

Conversation

Yan-waller
Copy link
Contributor

Signed-off-by: Yan Jun yan.jun8@zte.com.cn

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));
Copy link
Contributor

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

@mattbenjamin
Copy link
Contributor

@Yan-waller one nit found (ideas on improving the clarity of this sort of code would be welcome:)

@Yan-waller Yan-waller force-pushed the yj-wip-rgwrests3ccstringfind branch 2 times, most recently from 9d4496e to fa635c4 Compare July 2, 2016 03:03
Signed-off-by: Yan Jun <yan.jun8@zte.com.cn>
@Yan-waller
Copy link
Contributor Author

@mattbenjamin thanks, I have fixed it and kill some compiling warnings.

@Yan-waller
Copy link
Contributor Author

retest this please

@theanalyst
Copy link
Member

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('=');
Copy link
Contributor

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

@yehudasa yehudasa merged commit 4e40928 into ceph:master Dec 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants