X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=pdf2swf%2Fxpdf%2FGList.cc;h=fb5fd62847c03eb57d8c6444614945d1da435352;hb=eb361a0f099d689011066b71a9d5e5d9fd94b913;hp=9534232e87aadc84ef7a726223bbbd7cdecb5f36;hpb=c7432833fe3a6469d63fad135151a92e12877b94;p=swftools.git diff --git a/pdf2swf/xpdf/GList.cc b/pdf2swf/xpdf/GList.cc index 9534232..fb5fd62 100644 --- a/pdf2swf/xpdf/GList.cc +++ b/pdf2swf/xpdf/GList.cc @@ -12,6 +12,7 @@ #pragma implementation #endif +#include #include #include "gmem.h" #include "GList.h" @@ -22,14 +23,14 @@ GList::GList() { size = 8; - data = (void **)gmalloc(size * sizeof(void*)); + data = (void **)gmallocn(size, sizeof(void*)); length = 0; inc = 0; } GList::GList(int sizeA) { size = sizeA; - data = (void **)gmalloc(size * sizeof(void*)); + data = (void **)gmallocn(size, sizeof(void*)); length = 0; inc = 0; } @@ -81,12 +82,16 @@ void *GList::del(int i) { return p; } +void GList::sort(int (*cmp)(const void *obj1, const void *obj2)) { + qsort(data, length, sizeof(void *), cmp); +} + void GList::expand() { size += (inc > 0) ? inc : size; - data = (void **)grealloc(data, size * sizeof(void*)); + data = (void **)greallocn(data, size, sizeof(void*)); } void GList::shrink() { size -= (inc > 0) ? inc : size/2; - data = (void **)grealloc(data, size * sizeof(void*)); + data = (void **)greallocn(data, size, sizeof(void*)); }