summaryrefslogtreecommitdiff
path: root/Src/module.c
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2013-11-13 22:14:27 +0000
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2013-11-13 22:14:27 +0000
commit7a94960957e37c198e93dfbd7af864799b01650d (patch)
treebd38804dad3cfec7f90b92bc5e7830f84728f7a6 /Src/module.c
parent128034e2118036e3012b9a41520467e257ed263a (diff)
downloadzsh-7a94960957e37c198e93dfbd7af864799b01650d.tar.gz
zsh-7a94960957e37c198e93dfbd7af864799b01650d.zip
31977: It's OK to autoload a feature that's loaded.
Simply check that the feature is from the same module that's requested.
Diffstat (limited to 'Src/module.c')
-rw-r--r--Src/module.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/Src/module.c b/Src/module.c
index 5cc595c47..f5479c1a6 100644
--- a/Src/module.c
+++ b/Src/module.c
@@ -3419,12 +3419,15 @@ autofeatures(const char *cmdnam, const char *module, char **features,
int ret = 0, subret;
Module defm, m;
char **modfeatures = NULL;
+ int *modenables = NULL;
if (module) {
defm = (Module)find_module(module,
FINDMOD_ALIASP|FINDMOD_CREATE, NULL);
if ((defm->node.flags & MOD_LINKED) ? defm->u.linked :
- defm->u.handle)
+ defm->u.handle) {
(void)features_module(defm, &modfeatures);
+ (void)enables_module(defm, &modenables);
+ }
} else
defm = NULL;
@@ -3544,6 +3547,16 @@ autofeatures(const char *cmdnam, const char *module, char **features,
ret = 1;
continue;
}
+ /*
+ * If the feature is already provided by the module, there's
+ * nothing more to do.
+ */
+ if (modenables[ptr-modfeatures])
+ continue;
+ /*
+ * Otherwise, marking it for autoload will do the
+ * right thing when the feature is eventually used.
+ */
}
if (!m->autoloads) {
m->autoloads = znewlinklist();