src/array_list.c

changeset 968
b5814aac3a76
parent 953
581ad4fd01e9
equal deleted inserted replaced
967:a58f602ed2fe 968:b5814aac3a76
103 assert(size != NULL); 103 assert(size != NULL);
104 assert(src != NULL); 104 assert(src != NULL);
105 105
106 // determine capacity 106 // determine capacity
107 size_t cap = capacity == NULL ? *size : *capacity; 107 size_t cap = capacity == NULL ? *size : *capacity;
108 assert(*target != NULL || cap == 0);
108 109
109 // check if resize is required 110 // check if resize is required
110 size_t minsize = index + elem_count; 111 size_t minsize = index + elem_count;
111 size_t newsize = *size < minsize ? minsize : *size; 112 size_t newsize = *size < minsize ? minsize : *size;
112 bool needrealloc = newsize > cap; 113 bool needrealloc = newsize > cap;

mercurial