patch-source_common_ulist_c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. $OpenBSD: patch-source_common_ulist_c,v 1.1 2016/12/05 16:15:56 ajacoutot Exp $
  2. http://bugs.icu-project.org/trac/ticket/12827
  3. --- source/common/ulist.c.orig Wed Jun 15 20:58:17 2016
  4. +++ source/common/ulist.c Mon Dec 5 09:35:37 2016
  5. @@ -29,7 +29,6 @@ struct UList {
  6. UListNode *tail;
  7. int32_t size;
  8. - int32_t currentIndex;
  9. };
  10. static void ulist_addFirstItem(UList *list, UListNode *newItem);
  11. @@ -51,7 +50,6 @@ U_CAPI UList *U_EXPORT2 ulist_createEmptyList(UErrorCo
  12. newList->head = NULL;
  13. newList->tail = NULL;
  14. newList->size = 0;
  15. - newList->currentIndex = -1;
  16. return newList;
  17. }
  18. @@ -80,8 +78,9 @@ static void ulist_removeItem(UList *list, UListNode *p
  19. } else {
  20. p->next->previous = p->previous;
  21. }
  22. - list->curr = NULL;
  23. - list->currentIndex = 0;
  24. + if (p == list->curr) {
  25. + list->curr = p->next;
  26. + }
  27. --list->size;
  28. if (p->forceDelete) {
  29. uprv_free(p->data);
  30. @@ -150,7 +149,6 @@ U_CAPI void U_EXPORT2 ulist_addItemBeginList(UList *li
  31. newItem->next = list->head;
  32. list->head->previous = newItem;
  33. list->head = newItem;
  34. - list->currentIndex++;
  35. }
  36. list->size++;
  37. @@ -193,7 +191,6 @@ U_CAPI void *U_EXPORT2 ulist_getNext(UList *list) {
  38. curr = list->curr;
  39. list->curr = curr->next;
  40. - list->currentIndex++;
  41. return curr->data;
  42. }
  43. @@ -209,7 +206,6 @@ U_CAPI int32_t U_EXPORT2 ulist_getListSize(const UList
  44. U_CAPI void U_EXPORT2 ulist_resetList(UList *list) {
  45. if (list != NULL) {
  46. list->curr = list->head;
  47. - list->currentIndex = 0;
  48. }
  49. }
  50. @@ -272,4 +268,3 @@ U_CAPI void U_EXPORT2 ulist_reset_keyword_values_itera
  51. U_CAPI UList * U_EXPORT2 ulist_getListFromEnum(UEnumeration *en) {
  52. return (UList *)(en->context);
  53. }
  54. -