Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Eliminate getparamnode() and the distinction between getnode() and getnode2()
- X-seq: zsh-workers 55158
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Philippe Altherr <philippe.altherr@xxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: [PATCH] Eliminate getparamnode() and the distinction between getnode() and getnode2()
- Date: Fri, 18 Sep 2026 07:54:29 +0200
- Arc-authentication-results: i=1; mx.google.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=fpr8rbBJwdacvH9qxjbgmc5PzH0+pIQyoEFAHED+fYI=; fh=RngAOd9wlRc8Glv1v2GOfDUnq2FsyrczungEY8JNfXY=; b=buUt9eWhD3DGjW+TQEqx4+qT/7rLv+8r/X/KnWqoox04exivGU6uCrWxUlgMvBh33s IVQtEDOQpRkrCboMM8rFL/pkKgHN/tqEd2t0fjnMfLal24fbTa4TwmN/VVtOhyXh+mYc C8566eoUfRxtmx0eLS3kgT8vy+bmDWnknNlyqwvUAQhRbxR/qHlR+C77cwt7S7gb6ZuJ RFMWAp78LaSH4DjGuKIjTo5XnwXkAIhW726kZnhYoBryuoM2F5yzc0B9i5Ex+Ey0PN8K hCEM6eLshJ+wDoOKpjfWl1kuaib/RS5e3lO8Vn2cya1tC6CrO9/EoViJ0aD++Chgb83Z ARTA==; darn=zsh.org
- Arc-seal: i=1; a=rsa-sha256; t=1789710882; cv=none; d=google.com; s=arc-20260327; b=X7eZoxp8AkG8oQfFlJP/UmpApTCkqVKdy/F1Lk+EKJ9KP1gV2PVfYuUtKITKIMt02J Rfaj/h9K7DN1Zomvy3ygzQPRdxCcxcfum62U5RDPnibHrIFZ5fIAqpJqAYgZ6/VrBXN7 ro6SU7bk4dOKk9GZ13iyadLHZ6gIMKOve1SzKEibwdVIjDMdMWHF3ZgtF+Cifs1YfqlU Ponw1vZlX6/RIBTS4esagIO4v8fbC4CdzsWxYBe58S6Ba8KjBaBdF5OuJ8KG6EFFHRfb z2aTYqd/O0Cy8sJ6RfrFXggsKLQdnv8tWQNyI/pb890ro4GTicj/BvOh76ZqbCRvhzbJ ObzA==
- Archived-at: <https://zsh.org/workers/55158>
- In-reply-to: <CAGdYchuewEbx23=kGUgJMqL+QJxUL29HT01KmoY3xo34bfuXBg@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <CAGdYchuewEbx23=kGUgJMqL+QJxUL29HT01KmoY3xo34bfuXBg@mail.gmail.com>
diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
index e8a6b6422..0ac758fbe 100644
--- a/Src/Zle/compresult.c
+++ b/Src/Zle/compresult.c
@@ -1082,7 +1082,7 @@ do_single(Cmatch m)
} else
n = p + 1;
- if ((pm = (Param) realparamtab->getnode(realparamtab, n)) &&
+ if ((pm = resolveparam(n, 1)) ||
PM_TYPE(pm->node.flags) != PM_SCALAR)
tryit = 0;
}
This will surely crash when pm is NULL and you access pm->node?
On Thu, Sep 10, 2026 at 11:29 PM Philippe Altherr
<philippe.altherr@xxxxxxxxx> wrote:
>
> This patch uses the functions newly introduced by workers/55145 to replace all [real]paramtab->getnode() and ->getnode2() calls with calls to getparam(), loadparam(), and resolveparam() that explicitly state what is intended. Most tab->getnode(tab, name) calls are replaced with an equivalent resolveparam(name, /*load=*/1) call and most tab->getnode2(tab, name) calls with an equivalent getparam(name) call but some calls are replaced by calls that do slightly less or more than their equivalent call. For example, there are cases where there is no need to load the resolved parameter or cases where the looked up parameter should not only exist but also be one that is set. For an easier review, the different replacements are split into separate commits on GitHub.
>
> Once all getnode() calls have been replaced, there is no longer any need to have distinct getnode() and getnode2() functions for the parameter table. Both can use gethashnode2(), i.e., simply return the node/parameter with the requested name, and getparamnode() can be eliminated.
>
> - Eliminate getparamnode() and the distinction between getnode() and getnode2()
> (depends on workers/55145)
>
> Philippe
>
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author