RFC 17: Dynamic Array Sizing

Frank Warmerdam warmerdam at POBOX.COM
Mon May 15 08:59:03 EDT 2006


Tamas Szekeres wrote:
> Frank,
> 
> 2006/5/15, Frank Warmerdam <warmerdam at pobox.com>:
> 
>> > Is it possible to add the new items automatically on demand?
>> I think that is what I'm proposing!  In what sense do you mean?
> 
> I have mentioned to eliminate the following issues from the code, like:
> mapfile.c (4663)
> 
> case(LAYER):
>      if(map->numlayers == MS_MAXLAYERS) {
>         msSetError(MS_IDENTERR, "Maximum number of layers reached.",
> "msLoadMap()");
>         return(NULL);
>      }
> 
> When the program needs more items of a particular time it should
> allocate it automatically. I couldn't read this from the RFC, but it
> may be there and i have missed it.

Tamas,

That was intended to be indicated by this entry:

* mapfile.c: set maxlayers to MS_MAXLAYERS and allocate layers accordingly in
   initMap().  Use msGrowMapLayers() before calling initLayer() when parsing.

So, the above code would become.

case (LAYER):
     msGrowMapLayers( map );
     ...

The msGrowMapLayers() would be responsible for ensuring that there is
*at least* one available unused layer object in the layers array.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGF, http://osgeo.org



More information about the mapserver-dev mailing list