vlc | branch: master | Lyndon Brown <jnq...@gmail.com> | Tue Apr 9 01:11:28 2019 +0100| [5c1e0c7ea822894ccda4bbbf6790a3c4280d39f1] | committer: Felix Paul Kühne
macosx: simplify and cache result of is-main check Signed-off-by: Felix Paul Kühne <fe...@feepk.net> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5c1e0c7ea822894ccda4bbbf6790a3c4280d39f1 --- modules/gui/macosx/preferences/prefs.m | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/gui/macosx/preferences/prefs.m b/modules/gui/macosx/preferences/prefs.m index a8847e7189..60d7aef2a9 100644 --- a/modules/gui/macosx/preferences/prefs.m +++ b/modules/gui/macosx/preferences/prefs.m @@ -492,10 +492,11 @@ unsigned int confsize; module_t * p_module = modules[i]; + bool mod_is_main = module_is_main(p_module); /* Exclude empty plugins (submodules don't have config */ /* options, they are stored in the parent module) */ - if (module_is_main(p_module)) { + if (mod_is_main) { pluginItem = self; _configItems = module_config_get(p_module, &confsize); _configSize = confsize; @@ -507,6 +508,7 @@ for (unsigned int j = 0; j < confsize; j++) { int configType = p_configs[j].i_type; + if (configType == CONFIG_CATEGORY) { categoryItem = [self itemRepresentingCategory:(int)p_configs[j].value.i]; if (!categoryItem) { @@ -514,8 +516,10 @@ if (categoryItem) [[self children] addObject:categoryItem]; } + continue; } - else if (configType == CONFIG_SUBCATEGORY) { + + if (configType == CONFIG_SUBCATEGORY) { lastsubcat = (int)p_configs[j].value.i; if (categoryItem && ![self isSubCategoryGeneral:lastsubcat]) { subCategoryItem = [categoryItem itemRepresentingSubCategory:lastsubcat]; @@ -525,16 +529,20 @@ [[categoryItem children] addObject:subCategoryItem]; } } + continue; } - if (module_is_main(p_module) && (CONFIG_ITEM(configType) || configType == CONFIG_SECTION)) { + if (!CONFIG_ITEM(configType) && configType != CONFIG_SECTION) + continue; + + if (mod_is_main) { if (categoryItem && [self isSubCategoryGeneral:lastsubcat]) { [[categoryItem options] addObject:[[VLCTreeLeafItem alloc] initWithConfigItem:&p_configs[j]]]; } else if (subCategoryItem) { [[subCategoryItem options] addObject:[[VLCTreeLeafItem alloc] initWithConfigItem:&p_configs[j]]]; } } - else if (!module_is_main(p_module) && (CONFIG_ITEM(configType) || configType == CONFIG_SECTION)) { + else { if (subCategoryItem && ![[subCategoryItem children] containsObject: pluginItem]) { [[subCategoryItem children] addObject:pluginItem]; } _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits