| 76 | } |
| 77 | |
| 78 | void* XOrdRemove(st_XORDEREDARRAY* array, void* elt, S32 index) |
| 79 | { |
| 80 | if (elt == NULL) |
| 81 | { |
| 82 | if (index < 0) |
| 83 | { |
| 84 | return NULL; |
| 85 | } |
| 86 | if (index >= array->max) |
| 87 | { |
| 88 | return NULL; |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | if ((index >= 0) && (index < array->max)) |
| 93 | { |
| 94 | elt = array->list[index]; |
| 95 | } |
| 96 | else if (elt != NULL) |
| 97 | { |
| 98 | index = -1; |
| 99 | int iVar4 = 0; |
| 100 | for (int i = array->cnt; i > 0; i--) |
| 101 | { |
| 102 | if (array->list[iVar4] == elt) |
| 103 | { |
| 104 | index = iVar4; |
| 105 | break; |
| 106 | } |
| 107 | iVar4++; |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | if (index < 0) |
| 112 | { |
| 113 | return NULL; |
| 114 | } |
| 115 | |
| 116 | array->cnt--; |
| 117 | for (; index < array->cnt; index++) |
| 118 | { |
| 119 | array->list[index] = array->list[index + 1]; |
| 120 | } |
| 121 | |
| 122 | return elt; |
| 123 | } |
| 124 | |
| 125 | S32 XOrdLookup(st_XORDEREDARRAY* array, const void* key, XOrdTestCallback test) |
| 126 | { |
no outgoing calls
no test coverage detected