1 //========================================================================
5 // Copyright 2001-2003 Glyph & Cog, LLC
7 //========================================================================
11 #ifdef USE_GCC_PRAGMAS
12 #pragma implementation
19 //------------------------------------------------------------------------
21 //------------------------------------------------------------------------
25 data = (void **)gmalloc(size * sizeof(void*));
30 GList::GList(int sizeA) {
32 data = (void **)gmalloc(size * sizeof(void*));
41 void GList::append(void *p) {
48 void GList::append(GList *list) {
51 while (length + list->length > size) {
54 for (i = 0; i < list->length; ++i) {
55 data[length++] = list->data[i];
59 void GList::insert(int i, void *p) {
64 memmove(data+i+1, data+i, (length - i) * sizeof(void *));
70 void *GList::del(int i) {
75 memmove(data+i, data+i+1, (length - i - 1) * sizeof(void *));
78 if (size - length >= ((inc > 0) ? inc : size/2)) {
84 void GList::expand() {
85 size += (inc > 0) ? inc : size;
86 data = (void **)grealloc(data, size * sizeof(void*));
89 void GList::shrink() {
90 size -= (inc > 0) ? inc : size/2;
91 data = (void **)grealloc(data, size * sizeof(void*));