X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;f=list.c;h=fabad4d6e62daa622df23bd3143967e51c6500c9;hb=4a7d8053ae7866932c796465a4e8cd0bc5ca7fd3;hp=a336b84aff7569223d1ec1c9546506df9aa7c5e7;hpb=fcb93b2ca79dbddd7a8754f65d72b78c4d6c13b5;p=project%2Fuci.git diff --git a/list.c b/list.c index a336b84..fabad4d 100644 --- a/list.c +++ b/list.c @@ -9,7 +9,7 @@ * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Lesser General Public License for more details. */ static void uci_list_set_pos(struct uci_list *head, struct uci_list *ptr, int pos) @@ -19,11 +19,12 @@ static void uci_list_set_pos(struct uci_list *head, struct uci_list *ptr, int po uci_list_del(ptr); uci_foreach_element(head, p) { - new_head = &p->list; if (pos-- <= 0) break; + new_head = &p->list; } - uci_list_add(new_head, ptr); + + uci_list_add(new_head->next, ptr); } static inline void uci_list_fixup(struct uci_list *ptr)