cleanup: remove legacy enc_dbcs global #9660

This commit is contained in:
Justin M. Keyes
2019-03-02 02:33:36 +01:00
committed by GitHub
parent 708176aea1
commit ed4132d7e9
8 changed files with 27 additions and 71 deletions

View File

@@ -5489,24 +5489,18 @@ uc_check_code(
break;
case 1: /* Quote, but don't split */
result = STRLEN(eap->arg) + 2;
for (p = eap->arg; *p; ++p) {
if (enc_dbcs != 0 && (*mb_ptr2len)(p) == 2)
/* DBCS can contain \ in a trail byte, skip the
* double-byte character. */
++p;
else if (*p == '\\' || *p == '"')
++result;
for (p = eap->arg; *p; p++) {
if (*p == '\\' || *p == '"') {
result++;
}
}
if (buf != NULL) {
*buf++ = '"';
for (p = eap->arg; *p; ++p) {
if (enc_dbcs != 0 && (*mb_ptr2len)(p) == 2)
/* DBCS can contain \ in a trail byte, copy the
* double-byte character to avoid escaping. */
*buf++ = *p++;
else if (*p == '\\' || *p == '"')
for (p = eap->arg; *p; p++) {
if (*p == '\\' || *p == '"') {
*buf++ = '\\';
}
*buf++ = *p;
}
*buf = '"';