On 18.11.2013 21:00, Yann E. MORIN wrote: > Victor, All, > > On 2013-10-26 22:55 +0300, v1kt0p.rus@xxxxxxxxx spake thusly: >> Adding the ability to search in description. >> >> Signed-off-by: Victor Danchenko <v1kt0p.rus@xxxxxxxxx> > > Your patch is space-mangled, and does not apply: > > $ pwclient git-am 3098691 > Applying patch #3098691 using 'git am' > Description: kconfig:qconf: Add an option to the "find" dialog for search in the description. > Applying: kconfig:qconf: Add an option to the "find" dialog for search in the description. > error: patch failed: scripts/kconfig/lkc_proto.h:35 > error: scripts/kconfig/lkc_proto.h: patch does not apply > error: patch failed: scripts/kconfig/mconf.c:430 > error: scripts/kconfig/mconf.c: patch does not apply > error: patch failed: scripts/kconfig/nconf.c:720 > error: scripts/kconfig/nconf.c: patch does not apply > error: patch failed: scripts/kconfig/qconf.cc:1197 > error: scripts/kconfig/qconf.cc: patch does not apply > error: patch failed: scripts/kconfig/qconf.h:5 > error: scripts/kconfig/qconf.h: patch does not apply > error: patch failed: scripts/kconfig/symbol.c:990 > error: scripts/kconfig/symbol.c: patch does not apply > Patch failed at 0001 kconfig:qconf: Add an option to the "find" dialog > for search in the description. > The copy of the patch that failed is found in: > /home/ymorin/dev/linux/linux-kconfig/.git/rebase-apply/patch > When you have resolved this problem, run "git am --resolved". > If you prefer to skip this patch, run "git am --skip" instead. > To restore the original branch and stop patching, run "git am --abort". > > Sending via a webmail (eg. gmail) is broken. Please use git 'send-email' > to send your patch. > > Regards, > Yann E. MORIN. > Sorry, Thunderbird replace tabs by spaces. Proper patch: Signed-off-by: Victor Danchenko <v1kt0p.rus@xxxxxxxxx> --- scripts/kconfig/lkc_proto.h | 3 ++- scripts/kconfig/mconf.c | 2 +- scripts/kconfig/nconf.c | 2 +- scripts/kconfig/qconf.cc | 13 ++++++++++++- scripts/kconfig/qconf.h | 3 +++ scripts/kconfig/symbol.c | 41 ++++++++++++++++++++++++++++++++++++++--- 6 files changed, 57 insertions(+), 7 deletions(-) diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index ecdb965..5379647 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h @@ -35,7 +35,8 @@ P(sym_lookup,struct symbol *,(const char *name, int flags)); P(sym_find,struct symbol *,(const char *name)); P(sym_expand_string_value,const char *,(const char *in)); P(sym_escape_string_value, const char *,(const char *in)); -P(sym_re_search,struct symbol **,(const char *pattern)); +P(sym_re_search, struct symbol **, (const char *pattern, + const bool in_description)); P(sym_type_name,const char *,(enum symbol_type type)); P(sym_calc_value,void,(struct symbol *sym)); P(sym_get_type,enum symbol_type,(struct symbol *sym)); diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 2c39631..e7aeb5b 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c @@ -430,7 +430,7 @@ again: stpart.text = str_get(&sttext); list_add_tail(&stpart.entries, &trail); - sym_arr = sym_re_search(dialog_input); + sym_arr = sym_re_search(dialog_input, false); do { LIST_HEAD(head); struct menu *targets[JUMP_NB]; diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c index 4fbecd2..bac5054 100644 --- a/scripts/kconfig/nconf.c +++ b/scripts/kconfig/nconf.c @@ -720,7 +720,7 @@ again: if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0) dialog_input += strlen(CONFIG_); - sym_arr = sym_re_search(dialog_input); + sym_arr = sym_re_search(dialog_input, false); res = get_relations_str(sym_arr, NULL); free(sym_arr); show_scroll_win(main_window, diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 1500c38..3df276a 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc @@ -1197,6 +1197,9 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam layout2->addWidget(searchButton); layout1->addLayout(layout2); + searchInDescription = new QCheckBox(_("Search in all texts."), this); + layout1->addWidget(searchInDescription); + split = new QSplitter(this); split->setOrientation(Qt::Vertical); list = new ConfigView(split, name); @@ -1253,7 +1256,15 @@ void ConfigSearchWindow::search(void) list->list->clear(); info->clear(); - result = sym_re_search(editField->text().latin1()); + bool in_description = false; +#if QT_VERSION >= 0x040000 + if (searchInDescription->checkState() == Qt::Checked) { +#else + if (searchInDescription->isChecked() == TRUE) { +#endif + in_description = true; + } + result = sym_re_search(editField->text().latin1(), in_description); if (!result) return; for (p = result; *p; p++) { diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index 3715b3e..70f283e 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h @@ -5,8 +5,10 @@ #if QT_VERSION < 0x040000 #include <qlistview.h> +#include <qcheckbox.h> #else #include <q3listview.h> +#include <QCheckBox> #endif #include <qsettings.h> @@ -294,6 +296,7 @@ protected: QSplitter* split; ConfigView* list; ConfigInfoView* info; + QCheckBox *searchInDescription; struct symbol **result; }; diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index c9a6775..baa6ac3 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -990,7 +990,7 @@ static int sym_rel_comp(const void *sym1, const void *sym2) return strcmp(s1->sym->name, s2->sym->name); } -struct symbol **sym_re_search(const char *pattern) +struct symbol **sym_re_search(const char *pattern, const bool in_description) { struct symbol *sym, **sym_arr = NULL; struct sym_match *sym_match_arr = NULL; @@ -1008,8 +1008,43 @@ struct symbol **sym_re_search(const char *pattern) for_all_symbols(i, sym) { if (sym->flags & SYMBOL_CONST || !sym->name) continue; - if (regexec(&re, sym->name, 1, match, 0)) - continue; + if (in_description) { + struct property *prop; + size_t length = 1; + if (sym->name) + length += strlen(sym->name); + for_all_prompts(sym, prop) { + if (prop->text) + length += strlen(prop->text) + 1; + if (prop->menu && prop->menu->help) + length += strlen(prop->menu->help) + 1; + } + char *all_text = 0; + all_text = malloc(length); + if (!all_text) + goto sym_re_search_free; + *all_text = 0; + if (sym->name) + strcat(all_text, sym->name); + for_all_prompts(sym, prop) { + if (prop->text) { + strcat(all_text, "\n"); + strcat(all_text, prop->text); + } + if (prop->menu && prop->menu->help) { + strcat(all_text, "\n"); + strcat(all_text, prop->menu->help); + } + } + if (regexec(&re, all_text, 1, match, 0)) { + free(all_text); + continue; + } + free(all_text); + } else { + if (regexec(&re, sym->name, 1, match, 0)) + continue; + } if (cnt >= size) { void *tmp; size += 16; Or in base64: U2lnbmVkLW9mZi1ieTogVmljdG9yIERhbmNoZW5rbyA8djFrdDBwLnJ1c0BnbWFpbC5jb20+Ci0t LQogc2NyaXB0cy9rY29uZmlnL2xrY19wcm90by5oIHwgIDMgKystCiBzY3JpcHRzL2tjb25maWcv bWNvbmYuYyAgICAgfCAgMiArLQogc2NyaXB0cy9rY29uZmlnL25jb25mLmMgICAgIHwgIDIgKy0K IHNjcmlwdHMva2NvbmZpZy9xY29uZi5jYyAgICB8IDEzICsrKysrKysrKysrKy0KIHNjcmlwdHMv a2NvbmZpZy9xY29uZi5oICAgICB8ICAzICsrKwogc2NyaXB0cy9rY29uZmlnL3N5bWJvbC5jICAg IHwgNDEgKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKystLS0KIDYgZmlsZXMg Y2hhbmdlZCwgNTcgaW5zZXJ0aW9ucygrKSwgNyBkZWxldGlvbnMoLSkKZGlmZiAtLWdpdCBhL3Nj cmlwdHMva2NvbmZpZy9sa2NfcHJvdG8uaCBiL3NjcmlwdHMva2NvbmZpZy9sa2NfcHJvdG8uaApp bmRleCBlY2RiOTY1Li41Mzc5NjQ3IDEwMDY0NAotLS0gYS9zY3JpcHRzL2tjb25maWcvbGtjX3By b3RvLmgKKysrIGIvc2NyaXB0cy9rY29uZmlnL2xrY19wcm90by5oCkBAIC0zNSw3ICszNSw4IEBA IFAoc3ltX2xvb2t1cCxzdHJ1Y3Qgc3ltYm9sICosKGNvbnN0IGNoYXIgKm5hbWUsIGludCBmbGFn cykpOwogUChzeW1fZmluZCxzdHJ1Y3Qgc3ltY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leHQgPSAwOworCQkJaWYgKHN5bS0+bmFtZSkKKwkJCQlzdHJjYXQoYWxsX3Rl eHQsIHN5bS0+bmFtZSk7CisJCQlmb3JfYWxsX3Byb21wdHMoc3ltLCBwcm9wKSB7CisJCQkJaWYg KHByb3AtPnRleHQpIHsKKwkJCQkJc3RyY2F0KGFsbF90ZXh0LCAiXG4iKTsKKwkJCQkJc3RyY2F0 KGFsbF90ZXh0LCBwcm9wLT50ZXh0KTsKKwkJCQl9CisJCQkJaWYgKHByb3AtPm1lbnUgJiYgcHJv cC0+bWVudS0+aGVscCkgeworCQkJCQlzdHJjYXQoYWxsX3RleHQsICJcbiIpOworCQkJCQlzdHJj YXQoYWxsX3RleHQsIHByb3AtPm1lbnUtPmhlbHApOworCQkJCX0KKwkJCX0KKwkJCWlmIChyZWdl eGVjKCZyZSwgYWxsX3RleHQsIDEsIG1hdGNoLCAwKSkgeworCQkJCWZyZWUoYWxsX3RleHQpOwor CQkJCWNvbnRpbnVlOworCQkJfQorCQkJZnJlZShhbGxfdGV4dCk7CisJCX0gZWxzZSB7CisJCQlp ZiAocmVnZXhlYygmcmUsIHN5bS0+bmFtZSwgMSwgbWF0Y2gsIDApKQorCQkJCWNvbnRpbnVlOwor CQl9CiAJCWlmIChjbnQgPj0gc2l6ZSkgewogCQkJdm9pZCAqdG1wOwogCQkJc2l6ZSArPSAxNjsK -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html