summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Src/module.c15
2 files changed, 17 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 18538a5a1..63eca13a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2013-11-13 Peter Stephenson <p.w.stephenson@ntlworld.com>
+ * 31977: Src/module.c: no error if autoloading a feature that
+ is already loaded in a consistent fashion.
+
* Jun T.: 31971: locale fix for helpfiles.
* Martin Vaeth: 31959: .gitignore, Doc/help/.cvsignore,
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();