* Don't call isascii() here. It's deprecated in POSIX and not needed
for myesc's case.
* The check of the character class and range here should match what's
defined as {ESCSEQ} in scan.l, so for [[:xdigit:]] we use isxdigit();
for [0-7] we check '0' <= c <= '7' (not isdigit(c) because isdigit is
locale-dependant in standard's sense)
* Add missing length limit for "\x<hex>" (<hex> is at most 2 digits)
int sptr = 1;
while (sptr <= 3 &&
- isascii (array[sptr]) &&
- isdigit (array[sptr]))
- /* Don't increment inside loop control
- * because if isdigit() is a macro it might
- * expand into multiple increments ...
- */
+ array[sptr] >= '0' && array[sptr] <= '7') {
++sptr;
+ }
c = array[sptr];
array[sptr] = '\0';
{ /* \x<hex> */
int sptr = 2;
- while (isascii (array[sptr]) &&
- isxdigit (array[sptr]))
+ while (sptr <= 3 && isxdigit (array[sptr])) {
/* Don't increment inside loop control
- * because if isdigit() is a macro it might
+ * because if isxdigit() is a macro it might
* expand into multiple increments ...
*/
++sptr;
+ }
c = array[sptr];
array[sptr] = '\0';