summaryrefslogtreecommitdiff
path: root/src/burl.c
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2020-09-10 00:15:29 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2020-10-11 12:19:26 -0400
commitc58b95f2976a0563884a09a6aafb5e1332e3ca3b (patch)
tree2262699f6c12134fc7e7bf76db1a21ceb7903815 /src/burl.c
parent327de98b38d84921e342422f34848a4f85a4da9c (diff)
downloadlighttpd-git-c58b95f2976a0563884a09a6aafb5e1332e3ca3b.tar.gz
[core] light_isupper(), light_islower()
more efficient char checks (replace one comparision and one branch with one subtraction)
Diffstat (limited to 'src/burl.c')
-rw-r--r--src/burl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/burl.c b/src/burl.c
index af7f18df..5e2e8196 100644
--- a/src/burl.c
+++ b/src/burl.c
@@ -463,7 +463,7 @@ static void burl_offset_tolower (buffer * const b, const size_t off)
{
/*(skips over all percent-encodings, including encoding of alpha chars)*/
for (char *p = b->ptr+off; p[0]; ++p) {
- if (p[0] >= 'A' && p[0] <= 'Z') p[0] |= 0x20;
+ if (light_isupper(p[0])) p[0] |= 0x20;
else if (p[0]=='%' && light_isxdigit(p[1]) && light_isxdigit(p[2]))
p+=2;
}
@@ -474,7 +474,7 @@ static void burl_offset_toupper (buffer * const b, const size_t off)
{
/*(skips over all percent-encodings, including encoding of alpha chars)*/
for (char *p = b->ptr+off; p[0]; ++p) {
- if (p[0] >= 'a' && p[0] <= 'z') p[0] &= 0xdf;
+ if (light_islower(p[0])) p[0] &= 0xdf;
else if (p[0]=='%' && light_isxdigit(p[1]) && light_isxdigit(p[2]))
p+=2;
}