src: Inline some single character categorization functions

This commit is contained in:
Tatsuhiro Tsujikawa 2015-09-07 23:23:07 +09:00
parent 5afc25623e
commit 4f52f60b3c
2 changed files with 7 additions and 13 deletions

View File

@ -66,16 +66,6 @@ const char DEFAULT_STRIP_CHARSET[] = "\r\n\t ";
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) {
static const char unreserved[] = {'-', '.', '_', '~'};
return isAlpha(c) || isDigit(c) ||

View File

@ -158,11 +158,15 @@ std::string joinPath(InputIterator first, InputIterator last) {
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);