$OpenBSD: patch-source_common_ulist_c,v 1.1 2016/12/05 16:15:56 ajacoutot Exp $

http://bugs.icu-project.org/trac/ticket/12827

--- source/common/ulist.c.orig	Wed Jun 15 20:58:17 2016
+++ source/common/ulist.c	Mon Dec  5 09:35:37 2016
@@ -29,7 +29,6 @@ struct UList {
     UListNode *tail;
     
     int32_t size;
-    int32_t currentIndex;
 };
 
 static void ulist_addFirstItem(UList *list, UListNode *newItem);
@@ -51,7 +50,6 @@ U_CAPI UList *U_EXPORT2 ulist_createEmptyList(UErrorCo
     newList->head = NULL;
     newList->tail = NULL;
     newList->size = 0;
-    newList->currentIndex = -1;
     
     return newList;
 }
@@ -80,8 +78,9 @@ static void ulist_removeItem(UList *list, UListNode *p
     } else {
         p->next->previous = p->previous;
     }
-    list->curr = NULL;
-    list->currentIndex = 0;
+    if (p == list->curr) {
+        list->curr = p->next;
+    }
     --list->size;
     if (p->forceDelete) {
         uprv_free(p->data);
@@ -150,7 +149,6 @@ U_CAPI void U_EXPORT2 ulist_addItemBeginList(UList *li
         newItem->next = list->head;
         list->head->previous = newItem;
         list->head = newItem;
-        list->currentIndex++;
     }
     
     list->size++;
@@ -193,7 +191,6 @@ U_CAPI void *U_EXPORT2 ulist_getNext(UList *list) {
     
     curr = list->curr;
     list->curr = curr->next;
-    list->currentIndex++;
     
     return curr->data;
 }
@@ -209,7 +206,6 @@ U_CAPI int32_t U_EXPORT2 ulist_getListSize(const UList
 U_CAPI void U_EXPORT2 ulist_resetList(UList *list) {
     if (list != NULL) {
         list->curr = list->head;
-        list->currentIndex = 0;
     }
 }
 
@@ -272,4 +268,3 @@ U_CAPI void U_EXPORT2 ulist_reset_keyword_values_itera
 U_CAPI UList * U_EXPORT2 ulist_getListFromEnum(UEnumeration *en) {
     return (UList *)(en->context);
 }
-
