From: Yann E. MORIN" Date: Sun, 18 Nov 2012 11:41:44 +0000 (+0100) Subject: Synchronise with 3.7-rc6 X-Git-Tag: v3.7.0.0~4 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f5ffeec863a84aee4c7d653419907a8f8c70eff3;p=kconfig-frontends Synchronise with 3.7-rc6 Pulls in the CIRCLEQ fix. Signed-off-by: "Yann E. MORIN" --- diff --git a/.version b/.version index 036bad3..2002e50 100644 --- a/.version +++ b/.version @@ -1,2 +1,2 @@ -3.7.0-rc5 77b67063bb6bce6d475e910d3b886a606d0d91f7 Terrified Chipmunk +3.7.0-rc6 f4a75d2eb7b1e2206094b901be09adb31ba63681 Terrified Chipmunk hg diff --git a/configure.ac b/configure.ac index 473755d..6ecf47b 100644 --- a/configure.ac +++ b/configure.ac @@ -232,23 +232,6 @@ AC_CHECK_FUNCS([ bzero memmove memset ]) AC_CHECK_FUNCS([ strcasecmp strchr strcspn strdup strncasecmp strpbrk strrchr strspn strtol ]) AC_CHECK_FUNCS([ gettimeofday mkdir regcomp setlocale uname ]) -#---------------------------------------- -# Check headers and macros for circle queues -AC_CHECK_HEADERS( - [sys/queue.h], - [AC_MSG_CHECKING([for CIRCLEQ_XXX macros in sys/queue.h]) - AC_PREPROC_IFELSE( - [AC_LANG_PROGRAM( - [[#include - #ifndef CIRCLEQ_HEAD - #error no - #endif]] - [[]])], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - AC_MSG_ERROR([CIRCLEQ_XXX macros not defined in sys/queue.h (parser)])])], - [AC_MSG_ERROR([could not find sys/queue.h header (parser)])]) - #---------------------------------------- # Check for gettext, for the kconfig frontends [has_gettext="$enable_L10n"] diff --git a/frontends/mconf/mconf.c b/frontends/mconf/mconf.c index 48f6744..53975cf 100644 --- a/frontends/mconf/mconf.c +++ b/frontends/mconf/mconf.c @@ -312,7 +312,7 @@ static void set_config_filename(const char *config_filename) struct search_data { - struct jk_head *head; + struct list_head *head; struct menu **targets; int *keys; }; @@ -323,7 +323,7 @@ static void update_text(char *buf, size_t start, size_t end, void *_data) struct jump_key *pos; int k = 0; - CIRCLEQ_FOREACH(pos, data->head, entries) { + list_for_each_entry(pos, data->head, entries) { if (pos->offset >= start && pos->offset < end) { char header[4]; @@ -375,7 +375,7 @@ again: sym_arr = sym_re_search(dialog_input); do { - struct jk_head head = CIRCLEQ_HEAD_INITIALIZER(head); + LIST_HEAD(head); struct menu *targets[JUMP_NB]; int keys[JUMP_NB + 1], i; struct search_data data = { diff --git a/libs/parser/expr.h b/libs/parser/expr.h index bd2e098..cdd4860 100644 --- a/libs/parser/expr.h +++ b/libs/parser/expr.h @@ -12,7 +12,7 @@ extern "C" { #include #include -#include +#include "list.h" #ifndef __cplusplus #include #endif @@ -175,12 +175,11 @@ struct menu { #define MENU_ROOT 0x0002 struct jump_key { - CIRCLEQ_ENTRY(jump_key) entries; + struct list_head entries; size_t offset; struct menu *target; int index; }; -CIRCLEQ_HEAD(jk_head, jump_key); #define JUMP_NB 9 diff --git a/libs/parser/list.h b/libs/parser/list.h new file mode 100644 index 0000000..0ae730b --- /dev/null +++ b/libs/parser/list.h @@ -0,0 +1,91 @@ +#ifndef LIST_H +#define LIST_H + +/* + * Copied from include/linux/... + */ + +#undef offsetof +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) + +/** + * container_of - cast a member of a structure out to the containing structure + * @ptr: the pointer to the member. + * @type: the type of the container struct this is embedded in. + * @member: the name of the member within the struct. + * + */ +#define container_of(ptr, type, member) ({ \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) + + +struct list_head { + struct list_head *next, *prev; +}; + + +#define LIST_HEAD_INIT(name) { &(name), &(name) } + +#define LIST_HEAD(name) \ + struct list_head name = LIST_HEAD_INIT(name) + +/** + * list_entry - get the struct for this entry + * @ptr: the &struct list_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + */ +#define list_entry(ptr, type, member) \ + container_of(ptr, type, member) + +/** + * list_for_each_entry - iterate over list of given type + * @pos: the type * to use as a loop cursor. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry(pos, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = list_entry(pos->member.next, typeof(*pos), member)) + +/** + * list_empty - tests whether a list is empty + * @head: the list to test. + */ +static inline int list_empty(const struct list_head *head) +{ + return head->next == head; +} + +/* + * Insert a new entry between two known consecutive entries. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static inline void __list_add(struct list_head *_new, + struct list_head *prev, + struct list_head *next) +{ + next->prev = _new; + _new->next = next; + _new->prev = prev; + prev->next = _new; +} + +/** + * list_add_tail - add a new entry + * @new: new entry to be added + * @head: list head to add it before + * + * Insert a new entry before the specified head. + * This is useful for implementing queues. + */ +static inline void list_add_tail(struct list_head *_new, struct list_head *head) +{ + __list_add(_new, head->prev, head); +} + +#endif diff --git a/libs/parser/lkc_proto.h b/libs/parser/lkc_proto.h index 1d1c085..ef1a738 100644 --- a/libs/parser/lkc_proto.h +++ b/libs/parser/lkc_proto.h @@ -21,9 +21,9 @@ P(menu_get_root_menu,struct menu *,(struct menu *menu)); P(menu_get_parent_menu,struct menu *,(struct menu *menu)); P(menu_has_help,bool,(struct menu *menu)); P(menu_get_help,const char *,(struct menu *menu)); -P(get_symbol_str, void, (struct gstr *r, struct symbol *sym, struct jk_head +P(get_symbol_str, void, (struct gstr *r, struct symbol *sym, struct list_head *head)); -P(get_relations_str, struct gstr, (struct symbol **sym_arr, struct jk_head +P(get_relations_str, struct gstr, (struct symbol **sym_arr, struct list_head *head)); P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help)); diff --git a/libs/parser/menu.c b/libs/parser/menu.c index a3cade6..e98a05c 100644 --- a/libs/parser/menu.c +++ b/libs/parser/menu.c @@ -508,7 +508,7 @@ const char *menu_get_help(struct menu *menu) } static void get_prompt_str(struct gstr *r, struct property *prop, - struct jk_head *head) + struct list_head *head) { int i, j; struct menu *submenu[8], *menu, *location = NULL; @@ -544,12 +544,13 @@ static void get_prompt_str(struct gstr *r, struct property *prop, } else jump->target = location; - if (CIRCLEQ_EMPTY(head)) + if (list_empty(head)) jump->index = 0; else - jump->index = CIRCLEQ_LAST(head)->index + 1; + jump->index = list_entry(head->prev, struct jump_key, + entries)->index + 1; - CIRCLEQ_INSERT_TAIL(head, jump, entries); + list_add_tail(&jump->entries, head); } if (i > 0) { @@ -573,7 +574,8 @@ static void get_prompt_str(struct gstr *r, struct property *prop, /* * head is optional and may be NULL */ -void get_symbol_str(struct gstr *r, struct symbol *sym, struct jk_head *head) +void get_symbol_str(struct gstr *r, struct symbol *sym, + struct list_head *head) { bool hit; struct property *prop; @@ -612,7 +614,7 @@ void get_symbol_str(struct gstr *r, struct symbol *sym, struct jk_head *head) str_append(r, "\n\n"); } -struct gstr get_relations_str(struct symbol **sym_arr, struct jk_head *head) +struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head) { struct symbol *sym; struct gstr res = str_new(); diff --git a/scripts/ksync.list b/scripts/ksync.list index 9766b7a..aa8b9b6 100644 --- a/scripts/ksync.list +++ b/scripts/ksync.list @@ -21,6 +21,7 @@ scripts/kconfig/expr.c --> libs/parser/expr.c scripts/kconfig/expr.h --> libs/parser/expr.h scripts/kconfig/zconf.gperf --> libs/parser/hconf.gperf scripts/kconfig/zconf.l --> libs/parser/lconf.l +scripts/kconfig/list.h --> libs/parser/list.h scripts/kconfig/lkc.h --> libs/parser/lkc.h scripts/kconfig/lkc_proto.h --> libs/parser/lkc_proto.h scripts/kconfig/menu.c --> libs/parser/menu.c diff --git a/scripts/ksync.log b/scripts/ksync.log index 7a1042f..ce4a070 100644 --- a/scripts/ksync.log +++ b/scripts/ksync.log @@ -19,3 +19,4 @@ menuconfig: Extend dialog_textbox so that it can exit on arbitrary keypresses menuconfig: Remove superfluous conditionnal kconfig: document oldnoconfig to what it really does in conf.c kconfig/mconf.c: revision of curses initialization. +menuconfig: Replace CIRCLEQ by list_head-style lists.