From 7a94960957e37c198e93dfbd7af864799b01650d Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 13 Nov 2013 22:14:27 +0000 Subject: 31977: It's OK to autoload a feature that's loaded. Simply check that the feature is from the same module that's requested. --- ChangeLog | 3 +++ Src/module.c | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 18538a5a1..63eca13a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2013-11-13 Peter Stephenson + * 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(); -- cgit 1.4.1