]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
common/hobject: use string::append() to avoid temp object
authorKefu Chai <kchai@redhat.com>
Fri, 28 Apr 2017 06:13:53 +0000 (14:13 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 28 Apr 2017 06:41:42 +0000 (14:41 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/common/hobject.cc

index a965c87d62241894bf627a2cec695c5273af46d7..dffd471b7f95fc7421ff082874e78da588761f46 100644 (file)
@@ -75,7 +75,7 @@ string hobject_t::to_str() const
 
   char snap_with_hash[1000];
   char *t = snap_with_hash;
-  char *end = t + sizeof(snap_with_hash);
+  const char *end = t + sizeof(snap_with_hash);
 
   uint64_t poolid(pool);
   t += snprintf(t, end - t, "%.*llX", 16, (long long unsigned)poolid);
@@ -90,7 +90,7 @@ string hobject_t::to_str() const
   else
     t += snprintf(t, end - t, ".%llx", (long long unsigned)snap);
 
-  out += string(snap_with_hash);
+  out.append(snap_with_hash, t);
 
   out.push_back('.');
   append_escaped(oid.name, &out);