[mapserver-users] MS_MAXSYMBOLS
Jan Hartmann
jhart at frw.uva.nl
Mon Sep 9 04:55:42 PDT 2002
> Not exactly of hotbed of advanced programming techniques, but then again
> Layers and
> such are dynamically allocated but based upon a limit. Haven't had time
> to go back and monkey with that. The limits become an issue for maybe
> one user a year, there is a workaround and there are always more
> pressing needs. If someone would like to help in converting arrays to
> lists (layers/symbols/styles and so on) it would be welcomed.
>
Steve, does it really have to be that complex? Couldn't you just
reallocate a bigger bunch of memory when the maximum is reached?
Something like
extern int MS_MAXSYMBOLS; // in the header files
symbolObj *symbol;
int MS_MAXSYMBOLS = 64; // in the c-file where you initialize things
symbol = malloc(MS_MAXSYMBOLS * sizeof (symbolObj));
if (numsymbols == MS_MAXSYMBOLS) { // in mapsymbol.c
MS_MAXSYMBOLS += 64;
symbol = realloc(symbol,MS_MAXSYMBOLS*sizeof(symbolObj));
.... nothing to be changed further on ...
}
Realloc allocates a new block of memory and copies the contents of the
old one to it.
Same would go for all MS_MAX... defines in map.h. Wouldn't this solve a
lot of problems without extensive rewriting? I hate doing lists in C.
Jan
Jan Hartmann
Department of Geography
University of Amsterdam
jhart at frw.uva.nl
More information about the MapServer-users
mailing list