From: Yehuda Sadeh Date: Tue, 25 Jun 2013 18:03:12 +0000 (-0700) Subject: rgw: add str_startswith() X-Git-Tag: v0.67-rc1~128^2~44 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=422bb6d0acaece313041c5b6613b15d7600c764d;p=ceph.git rgw: add str_startswith() useful util Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 0fc35e00292b..d5e5ae61e4c0 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -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;