zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
To: zsh-workers@sunsite.auc.dk
Subject: Re: parameter structs still alive
Date: Mon, 24 Jan 2000 20:01:02 +0000	[thread overview]
Message-ID: <E12Cpd1-0006uP-00.2000-01-24-19-58-23@mail1.svr.pol.co.uk> (raw)
In-Reply-To: "Sven Wischnowsky"'s message of "Mon, 24 Jan 2000 14:53:42 +0100." <200001241353.OAA12217@beta.informatik.hu-berlin.de>

Sven Wischnowsky wrote:
> 
> Having had a look at the output of mem again, I noticed that every
> completion adds several blocks of 96 bytes (on a 64 Bit
> machine). These are struct pm's for the special parameters that don't
> get freed.
> 
> When I wrote the new completion stuff I copied the parameter stuff
> from zle_params.c and never really understood why the zleunsetfn() was 
> written the way it was written. The `if(ext) ...' test together with
> the fact that the parameters have the PM_SPECIAL flag have the effect
> that the struct are not freed.
> 
> Peter: which is the right way to do such things? Removing the
> PM_SPECIAL flag in zleunsetfn() and compunsetfn() at least makes the
> structs be freed, but that can't be the right solution...

This code was originally written by Zefram, and then modified by me to add
the PM_REMOVABLE flag: the problem was the original specials shouldn't even
be removed from the table, never mind deleted, if they're going to stay
special when unset, which is the advertised behaviour.  So we still need
some way of distinguishing removable parameters.

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.)

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

Index: Src/params.c
===================================================================
RCS file: /home/pws/CVSROOT/projects/zsh/Src/params.c,v
retrieving revision 1.4
diff -u -r1.4 params.c
--- Src/params.c	2000/01/07 19:42:02	1.4
+++ Src/params.c	2000/01/24 19:54:18
@@ -1933,9 +1933,7 @@
 	    adduserdir(oldpm->nam, oldpm->u.str, 0, 0);
     }
 
-    /* Even removable specials shouldn't be deleted. */
-    if (!(pm->flags & PM_SPECIAL))
-	paramtab->freenode((HashNode) pm); /* free parameter node */
+    paramtab->freenode((HashNode) pm); /* free parameter node */
 }
 
 /* Standard function to unset a parameter.  This is mostly delegated to *
 
-- 
Peter Stephenson <pws@pwstephenson.fsnet.co.uk>


  reply	other threads:[~2000-01-24 19:58 UTC|newest]

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

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=E12Cpd1-0006uP-00.2000-01-24-19-58-23@mail1.svr.pol.co.uk \
    --to=pws@pwstephenson.fsnet.co.uk \
    --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).