Messages in this thread Patch in this message | | | Date | Fri, 6 Aug 2010 16:09:23 +0200 | From | Sam Ravnborg <> | Subject | Re: [PATCH] nconfig: add search support |
| |
> > or I'd like to be able to find "crc" menu items in any sub-menu. > Maybe I should just stick to config symbol searches. I don't think it's all > that likely that people will know how each menu line text begins.
Following patch extends symbols search to search _both_ for CONFIG_ symbols AND prompts.
I think this could be a usefull extension. You are navigation much more around than me in the Kconfig files / editors. What do you think?
As this is an extension in the core part it will take effect for all the editors (which is good). [gconf does not use sym_re_search() - I assume this feature is missing in that editor].
I will cook up a proper patch only if I get positive feedback.
Sam
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index e95718f..8cda9c0 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -842,6 +842,7 @@ struct symbol *sym_find(const char *name) struct symbol **sym_re_search(const char *pattern) { + struct property *prop; struct symbol *sym, **sym_arr = NULL; int i, cnt, size; regex_t re; @@ -854,9 +855,15 @@ struct symbol **sym_re_search(const char *pattern) return NULL; for_all_symbols(i, sym) { + bool found = false; if (sym->flags & SYMBOL_CONST || !sym->name) continue; - if (regexec(&re, sym->name, 0, NULL, 0)) + if (!regexec(&re, sym->name, 0, NULL, 0)) + found = true; + for_all_prompts(sym, prop) + if (!regexec(&re, prop->text, 0, NULL, 0)) + found = true; + if (!found) continue; if (cnt + 1 >= size) { void *tmp = sym_arr;
| |