Skip to content

Commit 5c191a4

Browse files
committed
ext/standard/quot_print.c: Minor refactoring to php_hex2int()
We already check, and assume, that the value is hexadecimal
1 parent 3c8fd93 commit 5c191a4

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

ext/standard/quot_print.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,12 @@ static char php_hex2int(int c) /* {{{ */
3434
{
3535
if (isdigit(c)) {
3636
return c - '0';
37-
}
38-
else if (c >= 'A' && c <= 'F') {
37+
} else if (c >= 'A' && c <= 'F') {
3938
return c - 'A' + 10;
40-
}
41-
else if (c >= 'a' && c <= 'f') {
39+
} else {
40+
ZEND_ASSERT(c >= 'a' && c <= 'f');
4241
return c - 'a' + 10;
4342
}
44-
else {
45-
return -1;
46-
}
4743
}
4844
/* }}} */
4945

0 commit comments

Comments
 (0)