From a250d99bde4fab95bb01f0d084cf4a29ada24406 Mon Sep 17 00:00:00 2001 From: Benjamin Poirier Date: Mon, 15 Apr 2013 10:13:50 -0400 Subject: [PATCH] --- yaml --- r: 373695 b: refs/heads/master c: edb749f4390b3c1604233dc7c4fb0361f472e712 h: refs/heads/master i: 373693: b2bc570dfe5b8ac70fab10aacae2e5bec25ee7ba 373691: d036c7fd98261d93ac5bee5c937241cefff6de6d 373687: 89014477c3808264c2f25ac7053da5278bfc1566 373679: 629c3a23d3d32561d6a269d319f7f9c3838f3244 373663: 2ca1c9f1424ad81c20461184be9fcab4cb97b4d6 373631: 997ec41a31e2a195ccc2ee32daf98c287b2d3da7 v: v3 --- [refs] | 2 +- trunk/scripts/kconfig/list.h | 13 +++++++++++++ trunk/scripts/kconfig/mconf.c | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 9078c653f4a0..9bae7c4b32dc 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: a45c7dfb942b6c198d5cd283f8dcee145241a017 +refs/heads/master: edb749f4390b3c1604233dc7c4fb0361f472e712 diff --git a/trunk/scripts/kconfig/list.h b/trunk/scripts/kconfig/list.h index 0ae730be5f49..b87206cc92f4 100644 --- a/trunk/scripts/kconfig/list.h +++ b/trunk/scripts/kconfig/list.h @@ -50,6 +50,19 @@ struct list_head { &pos->member != (head); \ pos = list_entry(pos->member.next, typeof(*pos), member)) +/** + * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry + * @pos: the type * to use as a loop cursor. + * @n: another type * to use as temporary storage + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry_safe(pos, n, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member), \ + n = list_entry(pos->member.next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.next, typeof(*n), member)) + /** * list_empty - tests whether a list is empty * @head: the list to test. diff --git a/trunk/scripts/kconfig/mconf.c b/trunk/scripts/kconfig/mconf.c index 566288a76370..c5418d622a05 100644 --- a/trunk/scripts/kconfig/mconf.c +++ b/trunk/scripts/kconfig/mconf.c @@ -389,6 +389,7 @@ static void search_conf(void) .targets = targets, .keys = keys, }; + struct jump_key *pos, *tmp; res = get_relations_str(sym_arr, &head); dres = show_textbox_ext(_("Search Results"), (char *) @@ -402,6 +403,8 @@ static void search_conf(void) again = true; } str_free(&res); + list_for_each_entry_safe(pos, tmp, &head, entries) + free(pos); } while (again); free(sym_arr); str_free(&title);