Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH 1/2] Consolidated nofork substitution changes



On Thu, Sep 21, 2023 at 11:32 PM Jun T <takimoto-j@xxxxxxxxxxxxxxxxx> wrote:
>
> > 2023/09/22 13:16, Jun T <takimoto-j@xxxxxxxxxxxxxxxxx> wrote:
> >
> > -                 setsparam("REPLY", cmdarg);
> > +                 setsparam("REPLY", metafy(cmdarg, -1, META_HREALLOC));
>
> Sorry, we should use META_REALLOC.

I think this.

diff --git a/Src/subst.c b/Src/subst.c
index dc2052ee0..f37ae935e 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -2003,11 +2003,12 @@ paramsubst(LinkList l, LinkNode n, char **str,
int qt, int pf_flags,
         } else    /* parse error */
         errflag |= ERRFLAG_ERROR;
         if (rplytmp && !errflag) {
-        int onoerrs = noerrs;
+        int onoerrs = noerrs, rplylen;
         noerrs = 2;
-        if ((cmdarg = ztuff(rplytmp)))
-            setsparam("REPLY", cmdarg);
+        rplylen = zstuff(&cmdarg, rplytmp);
         noerrs = onoerrs;
+        if (rplylen >= 0)
+            setsparam("REPLY", metafy(cmdarg, rplylen, META_REALLOC));
         }
     }




Messages sorted by: Reverse Date, Date, Thread, Author