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

Re: ZSH_SCRIPT



On Thu, 3 Mar 2016 12:26:22 -0500
Greg Klanderman <gak@xxxxxxxxxxxxxx> wrote:
> Peter/Bart do you think it needs both ztrdup()s?
> 
> in zsh_main():
>     zsh_script = ztrdup(runscript);
> 
> and in createparamtable():
>     setsparam("ZSH_SCRIPT", ztrdup(zsh_script));

I think it needs the second, because what you pass to a parameter needs
to be uniquely managed by that parameter, so it can't point to memory
that can be referenced another way.  I doubt it needs the first as well.

Actually, I don't see why you need a glboal for zsh_script at all.  It's
just there to pass runscript on so it can be set later.  That's better
done by passing arguments rather than globals.

pws



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