X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;f=libuci.h;h=de96f45811bb955ebd6e39a959366fc1549f9edb;hb=3f70540dd2f63b866db50a76bbed2e087a276758;hp=aba435936bc11476ecaa4d84e0be19ca8889d14b;hpb=1d2aca0fc893bd253a66e1b2628f8c8c5925fb41;p=project%2Fuci.git diff --git a/libuci.h b/libuci.h index aba4359..de96f45 100644 --- a/libuci.h +++ b/libuci.h @@ -81,6 +81,8 @@ struct uci_context /* private: */ int errno; jmp_buf trap; + jmp_buf trap_saved; + int saved; }; struct uci_parse_context @@ -125,12 +127,13 @@ struct uci_option #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) #endif -#define uci_list_entry(type, ptr) \ - ((struct uci_#type *) ((char *)(ptr) - offsetof(struct uci_#type,list))) +#define uci_list_empty(list) (list->next == ptr) +#define uci_list_entry(_type, _ptr) \ + ((struct uci_ ## _type *) ((char *)(_ptr) - offsetof(struct uci_ ## _type,list))) -#define uci_foreach_entry(type, list, ptr) \ - for(ptr = uci_list_entry(type, (list)->next); \ - &ptr->list != list; \ - ptr = uci_list_entry(type, ptr->list.next)) +#define uci_foreach_entry(_type, _list, _ptr) \ + for(_ptr = uci_list_entry(_type, (_list)->next); \ + &_ptr->list != (_list); \ + _ptr = uci_list_entry(_type, _ptr->list.next)) #endif