- value = 0;
- for (i = 0; i < 4; i++) {
- unsigned char c = *cp++;
- if (!isxdigit(c)) {
- return "malformed \\u escape";
- }
- value = (value << 4) | hexit_value(c);
+ value = hexits_value(cp, 4, NULL);
+ if (value == UINT_MAX) {
+ return "malformed \\u escape";