• Home
  • Raw
  • Download

Lines Matching refs:impl

31   ArrayListImpl* impl;  in ArrayListCreateWithCapacity()  local
36 impl = NEW(ArrayListImpl, MTAG); in ArrayListCreateWithCapacity()
38 if (impl == NULL) in ArrayListCreateWithCapacity()
41 impl->Interface.add = &ArrayList_Add; in ArrayListCreateWithCapacity()
42 impl->Interface.insertAt = &ArrayList_InsertAt; in ArrayListCreateWithCapacity()
43 impl->Interface.contains = &ArrayList_Contains; in ArrayListCreateWithCapacity()
44 impl->Interface.destroy = &ArrayList_Destroy; in ArrayListCreateWithCapacity()
45 impl->Interface.get = &ArrayList_Get; in ArrayListCreateWithCapacity()
46 impl->Interface.getSize = &ArrayList_GetSize; in ArrayListCreateWithCapacity()
47 impl->Interface.remove = &ArrayList_Remove; in ArrayListCreateWithCapacity()
48 impl->Interface.removeAtIndex = &ArrayList_RemoveAtIndex; in ArrayListCreateWithCapacity()
49 impl->Interface.removeAll = &ArrayList_RemoveAll; in ArrayListCreateWithCapacity()
50 impl->Interface.set = &ArrayList_Set; in ArrayListCreateWithCapacity()
51 impl->Interface.toStaticArray = NULL; /* Not implemented */ in ArrayListCreateWithCapacity()
52 impl->Interface.clone = &ArrayList_Clone; in ArrayListCreateWithCapacity()
54 impl->contents = MALLOC(minCapacity * sizeof(void*), MTAG); in ArrayListCreateWithCapacity()
55 if (impl->contents == NULL) in ArrayListCreateWithCapacity()
57 FREE(impl); in ArrayListCreateWithCapacity()
60 impl->capacity = minCapacity; in ArrayListCreateWithCapacity()
61 impl->minCapacity = minCapacity; in ArrayListCreateWithCapacity()
62 impl->size = 0; in ArrayListCreateWithCapacity()
64 *self = (ArrayList*) impl; in ArrayListCreateWithCapacity()
74 static ESR_ReturnCode ArrayList_Insert_Internal(ArrayListImpl *impl, size_t index, void *element) in ArrayList_Insert_Internal() argument
78 if (impl->size >= impl->capacity) in ArrayList_Insert_Internal()
81 size_t newCapacity = impl->capacity * 2; in ArrayList_Insert_Internal()
82 void** temp = REALLOC(impl->contents, newCapacity * sizeof(void*)); in ArrayList_Insert_Internal()
85 impl->contents = temp; in ArrayList_Insert_Internal()
86 impl->capacity = newCapacity; in ArrayList_Insert_Internal()
89 for (i = impl->size; i > index; --i) in ArrayList_Insert_Internal()
90 impl->contents[i] = impl->contents[i - 1]; in ArrayList_Insert_Internal()
91 ++impl->size; in ArrayList_Insert_Internal()
92 impl->contents[index] = element; in ArrayList_Insert_Internal()
98 ArrayListImpl *impl = (ArrayListImpl *) self; in ArrayList_Add() local
100 return ArrayList_Insert_Internal(impl, impl->size, element); in ArrayList_Add()
105 ArrayListImpl *impl = (ArrayListImpl *) self; in ArrayList_InsertAt() local
107 if (index > impl->size) in ArrayList_InsertAt()
110 return ArrayList_Insert_Internal(impl, index, element); in ArrayList_InsertAt()
113 static ESR_ReturnCode ArrayList_Remove_Internal(ArrayListImpl *impl, size_t i) in ArrayList_Remove_Internal() argument
115 --impl->size; in ArrayList_Remove_Internal()
116 while (i < impl->size) in ArrayList_Remove_Internal()
118 impl->contents[i] = impl->contents[i+1]; in ArrayList_Remove_Internal()
122 if (impl->capacity > impl->minCapacity && in ArrayList_Remove_Internal()
123 impl->size <= impl->capacity / 4) in ArrayList_Remove_Internal()
126 size_t newCapacity = impl->capacity / 2; in ArrayList_Remove_Internal()
129 if ((temp = REALLOC(impl->contents, newCapacity * sizeof(void*))) == NULL) in ArrayList_Remove_Internal()
131 impl->contents = temp; in ArrayList_Remove_Internal()
132 impl->capacity = newCapacity; in ArrayList_Remove_Internal()
139 ArrayListImpl* impl = (ArrayListImpl*) self; in ArrayList_Remove() local
143 for (i = 0; i < impl->size; ++i) in ArrayList_Remove()
145 if (impl->contents[i] == element) in ArrayList_Remove()
146 return ArrayList_Remove_Internal(impl, i); in ArrayList_Remove()
154 ArrayListImpl* impl = (ArrayListImpl*) self; in ArrayList_RemoveAtIndex() local
156 if (index >= impl->size) in ArrayList_RemoveAtIndex()
159 return ArrayList_Remove_Internal(impl, index); in ArrayList_RemoveAtIndex()
164 ArrayListImpl* impl = (ArrayListImpl*) self; in ArrayList_RemoveAll() local
166 impl->size = 0; in ArrayList_RemoveAll()
173 ArrayListImpl* impl = (ArrayListImpl*) self; in ArrayList_Contains() local
176 for (i = 0; i < impl->size; ++i) in ArrayList_Contains()
178 if (impl->contents[i] == element) in ArrayList_Contains()
190 ArrayListImpl* impl = (ArrayListImpl*) self; in ArrayList_Get() local
192 if (index >= impl->size) in ArrayList_Get()
194 *element = impl->contents[index]; in ArrayList_Get()
200 ArrayListImpl* impl = (ArrayListImpl*) self; in ArrayList_Set() local
202 if (index >= impl->size) in ArrayList_Set()
204 impl->contents[index] = element; in ArrayList_Set()
210 ArrayListImpl* impl = (ArrayListImpl*) self; in ArrayList_GetSize() local
212 *size = impl->size; in ArrayList_GetSize()
236 ArrayListImpl* impl = (ArrayListImpl*) self; in ArrayList_Destroy() local
238 FREE(impl->contents); in ArrayList_Destroy()