src: Inline some single character categorization functions
This commit is contained in:
parent
5afc25623e
commit
4f52f60b3c
10
src/util.cc
10
src/util.cc
|
@ -66,16 +66,6 @@ const char DEFAULT_STRIP_CHARSET[] = "\r\n\t ";
|
||||||
|
|
||||||
const char UPPER_XDIGITS[] = "0123456789ABCDEF";
|
const char UPPER_XDIGITS[] = "0123456789ABCDEF";
|
||||||
|
|
||||||
bool isAlpha(const char c) {
|
|
||||||
return ('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z');
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isDigit(const char c) { return '0' <= c && c <= '9'; }
|
|
||||||
|
|
||||||
bool isHexDigit(const char c) {
|
|
||||||
return isDigit(c) || ('A' <= c && c <= 'F') || ('a' <= c && c <= 'f');
|
|
||||||
}
|
|
||||||
|
|
||||||
bool inRFC3986UnreservedChars(const char c) {
|
bool inRFC3986UnreservedChars(const char c) {
|
||||||
static const char unreserved[] = {'-', '.', '_', '~'};
|
static const char unreserved[] = {'-', '.', '_', '~'};
|
||||||
return isAlpha(c) || isDigit(c) ||
|
return isAlpha(c) || isDigit(c) ||
|
||||||
|
|
10
src/util.h
10
src/util.h
|
@ -158,11 +158,15 @@ std::string joinPath(InputIterator first, InputIterator last) {
|
||||||
return strjoin(elements.begin(), elements.end(), "/");
|
return strjoin(elements.begin(), elements.end(), "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isAlpha(const char c);
|
inline bool isAlpha(const char c) {
|
||||||
|
return ('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z');
|
||||||
|
}
|
||||||
|
|
||||||
bool isDigit(const char c);
|
inline bool isDigit(const char c) { return '0' <= c && c <= '9'; }
|
||||||
|
|
||||||
bool isHexDigit(const char c);
|
inline bool isHexDigit(const char c) {
|
||||||
|
return isDigit(c) || ('A' <= c && c <= 'F') || ('a' <= c && c <= 'f');
|
||||||
|
}
|
||||||
|
|
||||||
bool inRFC3986UnreservedChars(const char c);
|
bool inRFC3986UnreservedChars(const char c);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue