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

Re: PATCH: Re: Segfault on "zmodload -u zsh/parameter"



Bart Schaefer wrote:
> +/**/
> +nullnullsetfn(UNUSED(Param pm), UNUSED(int exp))
>  {}

Did you mean something like the following?

We can test for unloading zsh/parameter as long as we load it again; it
doesn't maintain any internal state.

> Should nullnullsetfn be used in other places instead of NULL, too?

I suppose it wouldn't hurt, at least.

> Why do we have nullstrsetfn and nullintsetfn but nullsethashfn?

Presumably it's never been needed.

Index: Src/params.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/params.c,v
retrieving revision 1.96
diff -u -r1.96 params.c
--- Src/params.c	21 Jan 2005 11:15:36 -0000	1.96
+++ Src/params.c	10 Mar 2005 17:27:03 -0000
@@ -147,7 +147,7 @@
 { hashgetfn, hashsetfn, stdunsetfn };
 /**/
 mod_export const struct gsu_hash nullsethash_gsu =
-{ hashgetfn, nullsethashfn, NULL };
+{ hashgetfn, nullsethashfn, nullunsetfn };
 
 
 /* Non standard methods (not exported) */
@@ -2604,6 +2604,11 @@
 nullintsetfn(UNUSED(Param pm), UNUSED(zlong x))
 {}
 
+/**/
+mod_export void
+nullunsetfn(UNUSED(Param pm), UNUSED(int exp))
+{}
+
 
 /* Function to get value of generic special integer *
  * parameter.  data is pointer to global variable   *
Index: Src/Modules/parameter.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/parameter.c,v
retrieving revision 1.34
diff -u -r1.34 parameter.c
--- Src/Modules/parameter.c	6 Feb 2005 20:36:44 -0000	1.34
+++ Src/Modules/parameter.c	10 Mar 2005 17:27:03 -0000
@@ -1817,7 +1817,7 @@
  * in a compile-time initialiser, so we use this instead.
  */
 static const struct gsu_hash pmnullsethash_gsu =
-{ hashgetfn, nullsethashfn, NULL };
+{ hashgetfn, nullsethashfn, nullunsetfn };
 static const struct gsu_hash pmcommands_gsu =
 { hashgetfn, setpmcommands, stdunsetfn };
 static const struct gsu_hash pmfunctions_gsu =
Index: Test/V01zmodload.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/V01zmodload.ztst,v
retrieving revision 1.6
diff -u -r1.6 V01zmodload.ztst
--- Test/V01zmodload.ztst	28 Sep 2001 14:43:13 -0000	1.6
+++ Test/V01zmodload.ztst	10 Mar 2005 17:27:03 -0000
@@ -151,11 +151,12 @@
  zmodload -e example
 1:Delete the module alias again
 
-# Don't unload the two modules that are required by the test system!
+# Don't unload the main module.
+# Do unload zsh/parameter, but reload it as it is needed.
 
  mods[(r)zsh/main]=()
- mods[(r)zsh/parameter]=()
  zmodunload $mods
+ zmodload zsh/parameter
 0d:Unload the modules loaded by this test suite
 
 %clean

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

**********************************************************************



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