From ee99c1f730dc18be65f417dbef67d4b08e04f065 Mon Sep 17 00:00:00 2001 From: Yan Jun Date: Fri, 15 Jul 2016 00:17:01 +0800 Subject: [PATCH] rgw: subtle optimization and cleanups Signed-off-by: Yan Jun --- src/rgw/rgw_metadata.cc | 4 ++-- src/rgw/rgw_rados.cc | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/rgw/rgw_metadata.cc b/src/rgw/rgw_metadata.cc index 3160ce0b1989..7cc4cad3b585 100644 --- a/src/rgw/rgw_metadata.cc +++ b/src/rgw/rgw_metadata.cc @@ -518,8 +518,8 @@ RGWMetadataHandler *RGWMetadataManager::get_handler(const string& type) void RGWMetadataManager::parse_metadata_key(const string& metadata_key, string& type, string& entry) { - int pos = metadata_key.find(':'); - if (pos < 0) { + auto pos = metadata_key.find(':'); + if (pos == string::npos) { type = metadata_key; } else { type = metadata_key.substr(0, pos); diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index d32f9b43d6e0..695f053151e2 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -4482,8 +4482,7 @@ int RGWRados::time_log_add(const string& oid, const real_time& ut, const string& utime_t t(ut); cls_log_add(op, t, section, key, bl); - r = io_ctx.operate(oid, &op); - return r; + return io_ctx.operate(oid, &op); } int RGWRados::time_log_add(const string& oid, list& entries, -- 2.47.3