aboutsummaryrefslogtreecommitdiff
path: root/lib/http_chunks.c
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2008-10-07 23:20:06 +0000
committerDan Fandrich <dan@coneharvesters.com>2008-10-07 23:20:06 +0000
commit79fc481a2b2151421752ffd6dba01c30a0dc5302 (patch)
treed0c3908d055656dfd89650cec336c08d62c1e6b3 /lib/http_chunks.c
parentb9ce8714631318f3252354534ac49fd4aa72dcb0 (diff)
Split off Curl_isxdigit function
Diffstat (limited to 'lib/http_chunks.c')
-rw-r--r--lib/http_chunks.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/http_chunks.c b/lib/http_chunks.c
index 0d72793ce..e0887483a 100644
--- a/lib/http_chunks.c
+++ b/lib/http_chunks.c
@@ -81,6 +81,14 @@
*/
+/* Check for an ASCII hex digit.
+ We avoid the use of isxdigit to accommodate non-ASCII hosts. */
+static bool Curl_isxdigit(char digit)
+{
+ return (digit >= 0x30 && digit <= 0x39) /* 0-9 */
+ || (digit >= 0x41 && digit <= 0x46) /* A-F */
+ || (digit >= 0x61 && digit <= 0x66); /* a-f */
+}
void Curl_httpchunk_init(struct connectdata *conn)
{
@@ -127,11 +135,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
while(length) {
switch(ch->state) {
case CHUNK_HEX:
- /* Check for an ASCII hex digit.
- We avoid the use of isxdigit to accommodate non-ASCII hosts. */
- if((*datap >= 0x30 && *datap <= 0x39) /* 0-9 */
- || (*datap >= 0x41 && *datap <= 0x46) /* A-F */
- || (*datap >= 0x61 && *datap <= 0x66)) { /* a-f */
+ if(Curl_isxdigit(*datap)) {
if(ch->hexindex < MAXNUM_SIZE) {
ch->hexbuffer[ch->hexindex] = *datap;
datap++;