[PATCH] parser: Use USTPUTC in parsebackq

Herbert Xu <[email protected]> Sun, 7 Jun 2026 21:16:37 +0800
Newsgroups org.kernel.vger.dash
Message-ID <[email protected]>
Move the CHECKSTRSPACE call out and replace STPUTC with USTPUTC
in parsebackq.

Signed-off-by: Herbert Xu <[email protected]>

diff --git a/src/parser.c b/src/parser.c
index 412e876..c69e0fb 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -1539,6 +1539,7 @@ parsebackq: {
                 int pc;
 
 		while (!done) {
+			CHECKSTRSPACE(MB_LEN_MAX + 1, pout);
 			if (needprompt) {
 				setprompt(2);
 			}
@@ -1551,8 +1552,7 @@ parsebackq: {
                                 pc = pgetc();
                                 if (pc != '\\' && pc != '`' && pc != '$'
                                     && (!synstack->dblquote || pc != '"'))
-                                        STPUTC('\\', pout);
-				CHECKSTRSPACE(MB_LEN_MAX, pout);
+                                        USTPUTC('\\', pout);
 				ml = getmbc(pc, pout, 2);
 				pout += ml;
 				if (ml)
@@ -1569,7 +1569,7 @@ parsebackq: {
 			default:
 				break;
 			}
-			STPUTC(pc, pout);
+			USTPUTC(pc, pout);
                 }
 		if (chkeofmark) {
 			out = pout;
-- 
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt