]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_string.h
74e023b4cb19e006017e90f049f9f9e205c9aba3
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #ifndef CEPH_RGW_STRING_H
5 #define CEPH_RGW_STRING_H
12 bool operator()(const string
& s1
, const string
& s2
) const
14 return strcasecmp(s1
.c_str(), s2
.c_str()) < 0;
18 static inline int stringcasecmp(const string
& s1
, const string
& s2
)
20 return strcasecmp(s1
.c_str(), s2
.c_str());
23 static inline int stringcasecmp(const string
& s1
, const char *s2
)
25 return strcasecmp(s1
.c_str(), s2
);
28 static inline int stringcasecmp(const string
& s1
, int ofs
, int size
, const string
& s2
)
30 return strncasecmp(s1
.c_str() + ofs
, s2
.c_str(), size
);
33 static inline int stringtoll(const string
& s
, int64_t *val
)
37 long long result
= strtoll(s
.c_str(), &end
, 10);
38 if (result
== LLONG_MAX
)
44 *val
= (int64_t)result
;
49 static inline int stringtoull(const string
& s
, uint64_t *val
)
53 unsigned long long result
= strtoull(s
.c_str(), &end
, 10);
54 if (result
== ULLONG_MAX
)
60 *val
= (uint64_t)result
;
65 static inline int stringtol(const string
& s
, int32_t *val
)
69 long result
= strtol(s
.c_str(), &end
, 10);
70 if (result
== LONG_MAX
)
76 *val
= (int32_t)result
;
81 static inline int stringtoul(const string
& s
, uint32_t *val
)
85 unsigned long result
= strtoul(s
.c_str(), &end
, 10);
86 if (result
== ULONG_MAX
)
92 *val
= (uint32_t)result
;