]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add str_startswith()
authorYehuda Sadeh <yehuda@inktank.com>
Tue, 25 Jun 2013 18:03:12 +0000 (11:03 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Tue, 25 Jun 2013 18:03:12 +0000 (11:03 -0700)
useful util

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/rgw/rgw_common.h

index 0fc35e00292bd55b5cd9af24b646433e72522b11..d5e5ae61e4c042f1d8b9ec137ba5a58baa8a6c17 100644 (file)
@@ -1105,6 +1105,11 @@ inline ostream& operator<<(ostream& out, const rgw_obj &o) {
   return out << o.bucket.name << ":" << o.object;
 }
 
+static inline bool str_startswith(const string& str, const string& prefix)
+{
+  return (str.compare(0, prefix.size(), prefix) == 0);
+}
+
 static inline void buf_to_hex(const unsigned char *buf, int len, char *str)
 {
   int i;