diff options
author | Yehuda Sadeh <yehuda@inktank.com> | 2013-06-25 11:03:12 -0700 |
---|---|---|
committer | Yehuda Sadeh <yehuda@inktank.com> | 2013-06-25 11:03:12 -0700 |
commit | 422bb6d0acaece313041c5b6613b15d7600c764d (patch) | |
tree | 9991eb570e003040daacdf17a6532a46567b2fcb | |
parent | 8db289f2e2ed0dccfa9c0d311e03eb729ceec406 (diff) | |
download | ceph-422bb6d0acaece313041c5b6613b15d7600c764d.tar.gz |
rgw: add str_startswith()
useful util
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
-rw-r--r-- | src/rgw/rgw_common.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 0fc35e00292..d5e5ae61e4c 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; |