1 //========================================================================
5 // Copyright 2001-2002 Glyph & Cog, LLC
7 //========================================================================
10 #pragma implementation
18 //------------------------------------------------------------------------
20 //------------------------------------------------------------------------
24 data = (void **)gmalloc(size * sizeof(void*));
29 GList::GList(int sizeA) {
31 data = (void **)gmalloc(size * sizeof(void*));
40 void GList::append(void *p) {
47 void GList::append(GList *list) {
50 while (length + list->length > size) {
53 for (i = 0; i < list->length; ++i) {
54 data[length++] = list->data[i];
58 void GList::insert(int i, void *p) {
63 memmove(data+i+1, data+i, (length - i) * sizeof(void *));
69 void *GList::del(int i) {
74 memmove(data+i, data+i+1, (length - i - 1) * sizeof(void *));
77 if (size - length >= ((inc > 0) ? inc : size/2)) {
83 void GList::expand() {
84 size += (inc > 0) ? inc : size;
85 data = (void **)grealloc(data, size * sizeof(void*));
88 void GList::shrink() {
89 size -= (inc > 0) ? inc : size/2;
90 data = (void **)grealloc(data, size * sizeof(void*));