Use standrad isxdigit instead of custom helper function. (#814)
Standard function available and on most platforms uses a lookup table and not a check with 3 ranges.
This commit is contained in:
parent
5c9f49e212
commit
c8999c6602
11
sds.c
11
sds.c
@ -889,13 +889,6 @@ sds sdscatrepr(sds s, const char *p, size_t len) {
|
|||||||
return sdscatlen(s,"\"",1);
|
return sdscatlen(s,"\"",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Helper function for sdssplitargs() that returns non zero if 'c'
|
|
||||||
* is a valid hex digit. */
|
|
||||||
int is_hex_digit(char c) {
|
|
||||||
return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') ||
|
|
||||||
(c >= 'A' && c <= 'F');
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Helper function for sdssplitargs() that converts a hex digit into an
|
/* Helper function for sdssplitargs() that converts a hex digit into an
|
||||||
* integer from 0 to 15 */
|
* integer from 0 to 15 */
|
||||||
int hex_digit_to_int(char c) {
|
int hex_digit_to_int(char c) {
|
||||||
@ -958,8 +951,8 @@ sds *sdssplitargs(const char *line, int *argc) {
|
|||||||
while(!done) {
|
while(!done) {
|
||||||
if (inq) {
|
if (inq) {
|
||||||
if (*p == '\\' && *(p+1) == 'x' &&
|
if (*p == '\\' && *(p+1) == 'x' &&
|
||||||
is_hex_digit(*(p+2)) &&
|
isxdigit(*(p+2)) &&
|
||||||
is_hex_digit(*(p+3)))
|
isxdigit(*(p+3)))
|
||||||
{
|
{
|
||||||
unsigned char byte;
|
unsigned char byte;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user