Re: [PATCH] Menuconfig search changes - pt. 3

From: Roman Zippel
Date: Fri Sep 03 2004 - 19:55:58 EST


Hi,

On Fri, 3 Sep 2004, Yuval Turgeman wrote:

> (Once again, this patch should be applied after Andrew's changes)

Please send a complete patch, it makes commenting on it easier.

> + if (regcomp(&re, pattern, REG_EXTENDED|REG_NOSUB))
> + return 0;
> + rc = regexec(&re, string, (size_t) 0, NULL, 0);
> + regfree(&re);

You shouldn't compute the pattern at every search.

> +static void show_expr(struct menu *menu, FILE *fp)
> +{
> + bool hit = false;
> + fprintf(fp, "Depends:\n ");
> + if (menu->dep) {
> + if (!hit)
> + hit = true;
> + expr_fprint(menu->dep, fp);
> + }

menu->dep contains only temporary information. The real information is in
prop->visible.expr.

> + if (menu->sym && menu->sym->dep) {
> + if (!hit)
> + hit = true;
> + expr_fprint(menu->sym->dep, fp);
> }

sym->dep doesn't contain user relevant information.

> + if (menu->sym) {
> + struct property *prop;
> + hit = false;
> + fprintf(fp, "\nSelects:\n ");
> + for_all_properties(menu->sym, prop, P_SELECT) {
> + if (!hit)
> + hit = true;
> + expr_fprint(prop->expr, fp);
> + }

With this you print all selection with every menu entry.
You probably also want to print sym->rev_dep, which is used to calculate
the selections for this symbol.

> while (submenu) {
> menu[j++] = submenu;
> submenu = submenu->parent;
> }

This loop should stop when you find root_menu.

> if (j > 0) {
> + if (!hit)
> + hit = true;
> + if (prop->text)
> + fprintf(fp, "%s (%s)\n", prop->text,
> + sym->name);
> else
> fprintf(fp, "%s\n", sym->name);

This test isn't necessary, every prompt has a text.

> + space = (char*)malloc(sizeof(char)*j);

This isn't necessary, just use "%*c" like the other indentations.

bye, Roman
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/