zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: parameter structs still alive
Date: Tue, 25 Jan 2000 10:29:49 +0100 (MET)	[thread overview]
Message-ID: <200001250929.KAA14128@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Peter Stephenson's message of Mon, 24 Jan 2000 20:01:02 +0000


Peter Stephenson wrote:

> ...
>
> However, looking at it again, such parameters are all (as far as I can see)
> created by createparam(), and so can be freed, therefore I should have made
> unsetparam_pm() free the struct when the flag was present --- i.e. just
> change the test and comment right at the end of the function.  This seems
> to be working so far, but maybe you should cast an eye over the effect in
> various modules, too.  (We don't need to test for non-removable specials
> since they were handled a couple of paragraphs back.)

Seems to work fine except for two function in the parameter module
which made named dirs and aliases be removed if one dared to unload
that module.

> Does anybody know what the second argument to the unsetfn() family is for?

It's set if the unset function was invoked by the user calling `unset' 
instead of an endparamscope() (I think the `exp' is for `explicit').

This is useful, for example, the completion code uses it to set its
special parameters to the empty string/array only if the user unset
them explicitly. If called from endparamscope(), the values are not
changed so that the completion code can still use them after the
widget has finished.

Bye
 Sven

diff -ru ../z.old/Src/Modules/parameter.c Src/Modules/parameter.c
--- ../z.old/Src/Modules/parameter.c	Tue Jan 25 09:15:13 2000
+++ Src/Modules/parameter.c	Tue Jan 25 10:23:40 2000
@@ -1418,6 +1418,9 @@
     int i;
     HashNode hn, next, hd;
 
+    if (!ht)
+	return;
+
     for (i = 0; i < nameddirtab->hsize; i++)
 	for (hn = nameddirtab->nodes[i]; hn; hn = next) {
 	    next = hn->next;
@@ -1426,9 +1429,6 @@
 		nameddirtab->freenode(hd);
 	}
 
-    if (!ht)
-	return;
-
     for (i = 0; i < ht->hsize; i++)
 	for (hn = ht->nodes[i]; hn; hn = hn->next) {
 	    struct value v;
@@ -1649,6 +1649,9 @@
     int i;
     HashNode hn, next, hd;
 
+    if (!ht)
+	return;
+
     for (i = 0; i < aliastab->hsize; i++)
 	for (hn = aliastab->nodes[i]; hn; hn = next) {
 	    next = hn->next;
@@ -1657,9 +1660,6 @@
 		(hd = aliastab->removenode(aliastab, hn->nam)))
 		aliastab->freenode(hd);
 	}
-
-    if (!ht)
-	return;
 
     for (i = 0; i < ht->hsize; i++)
 	for (hn = ht->nodes[i]; hn; hn = hn->next) {

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


             reply	other threads:[~2000-01-25  9:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-25  9:29 Sven Wischnowsky [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-01-24 13:53 Sven Wischnowsky
2000-01-24 20:01 ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200001250929.KAA14128@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).