21#define TOR_ISODIGIT(c) ('0' <= (c) && (c) <= '7')
45 if (cp[1] ==
'x' || cp[1] ==
'X') {
46 if (!(TOR_ISXDIGIT(cp[2]) && TOR_ISXDIGIT(cp[3])))
49 }
else if (TOR_ISODIGIT(cp[1])) {
51 if (TOR_ISODIGIT(*cp)) ++cp;
52 if (TOR_ISODIGIT(*cp)) ++cp;
53 }
else if (cp[1] ==
'n' || cp[1] ==
'r' || cp[1] ==
't' || cp[1] ==
'"'
54 || cp[1] ==
'\\' || cp[1] ==
'\'') {
66 out = *result = tor_malloc(cp-s + 1);
73 if (size_out) *size_out = out - *result;
85 case 'n': *out++ =
'\n'; cp += 2;
break;
86 case 'r': *out++ =
'\r'; cp += 2;
break;
87 case 't': *out++ =
'\t'; cp += 2;
break;
94 if (x1 == -1 || x2 == -1) {
103 *out++ = ((x1<<4) + x2);
107 case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
112 if (TOR_ISODIGIT(*cp)) { n = n*8 + *cp-
'0'; cp++; }
113 if (TOR_ISODIGIT(*cp)) { n = n*8 + *cp-
'0'; cp++; }
114 if (n > 255) {
tor_free(*result);
return NULL; }
Locale-independent character-type inspection (header)
static int hex_decode_digit(char c)
const char * unescape_string(const char *s, char **result, size_t *size_out)
Headers for util_malloc.c.
Macros to manage assertions, fatal and non-fatal.
#define tor_assert_nonfatal_unreached()
#define tor_fragile_assert()