From 43d480057b2255d4fc82cc4eded038bcea0b5cb6 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 10 Mar 2005 17:55:37 +0000 Subject: 20959: fix crash unloading zsh/parameter and test the fix --- ChangeLog | 5 +++++ Src/Modules/parameter.c | 2 +- Src/params.c | 7 ++++++- Test/V01zmodload.ztst | 5 +++-- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9c42c7290..ddcd88691 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-03-10 Peter Stephenson + + * 20959 (variant of 20958): Src/params.c, Src/Module/parameter.c, + Test/V01zmodload.ztst: fix crash unloading zsh/parameter and test. + 2005-03-09 Peter Stephenson * 20955: README, Src/builtin.c: "unset foo" should return diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c index 966b26e6f..faa18a92d 100644 --- a/Src/Modules/parameter.c +++ b/Src/Modules/parameter.c @@ -1817,7 +1817,7 @@ struct pardef { * 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 = diff --git a/Src/params.c b/Src/params.c index 5563e3acb..a233df90d 100644 --- a/Src/params.c +++ b/Src/params.c @@ -147,7 +147,7 @@ mod_export const struct gsu_hash stdhash_gsu = { 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 @@ void 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 * diff --git a/Test/V01zmodload.ztst b/Test/V01zmodload.ztst index 3787024e1..d26ae1e42 100644 --- a/Test/V01zmodload.ztst +++ b/Test/V01zmodload.ztst @@ -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 -- cgit 1.4.1