From: Matt Benjamin Date: Sun, 20 Dec 2015 04:35:47 +0000 (-0500) Subject: librgw: use string_ref remove_prefix X-Git-Tag: v10.1.0~382^2~83 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e448c4eb7fcd0700143aff4c69a34692e8b0072e;p=ceph.git librgw: use string_ref remove_prefix Save a few cycles over re-assigning a string_ref suffix substring to itself. Signed-off-by: Matt Benjamin --- diff --git a/src/rgw/rgw_file.h b/src/rgw/rgw_file.h index 2c902306273d9..c25231abe8f6a 100644 --- a/src/rgw/rgw_file.h +++ b/src/rgw/rgw_file.h @@ -889,7 +889,7 @@ public: size_t last_del = sref.find_last_of('/'); if (last_del != string::npos) - sref = sref.substr(last_del+1); + sref.remove_prefix(last_del+1); /* if we find a trailing slash in a -listing- the parent is an @@ -916,6 +916,9 @@ public: << " iter second: " << iter.second << std::endl; + /* it's safest to modify the element in place--a suffix-modifying + * string_ref operation is problematic since ULP rgw_file callers + * will ultimately need a c-string */ if (iter.first.back() == '/') const_cast(iter.first).pop_back(); @@ -923,7 +926,7 @@ public: size_t last_del = sref.find_last_of('/'); if (last_del != string::npos) - sref = sref.substr(last_del+1); + sref.remove_prefix(last_del+1); lsubdout(cct, rgw, 15) << "RGWReaddirRequest " << __func__ << " "