MapServer / MapServer-import

3 stars 2 forks source link

Empty METADATA items on MAP, LAYER, and WEB #2203

Closed tbonfort closed 12 years ago

tbonfort commented 12 years ago

Reporter: hobu Date: 2007/08/03 - 19:40 It seems that we are now keeping empty METADATA blocks around for these items. They show up when we do a mapObj.save().


<hobu>  The other issue that metadata thing causes is there are places 
        in the code that do things like 
        if(&(layer->metadata)) msFreeHashItems(&(layer->metadata));
<hobu>  layer->metadata is now an active pointer with 
        nothing in it, so we end up trying to free empty hashitems (and fail)
<sdlime> we need msHashIsEmpty function
tbonfort commented 12 years ago

Author: hobu Date: 2007/08/04 - 04:49 added msHashIsEmpty in cd91e2ddc837d5b4899057ac53d95030917fcf03 (r6458)

tbonfort commented 12 years ago

Author: hobu Date: 2007/08/04 - 04:53 A couple of related questions about msFreeHashItems....

We shouldn't be using naked free's there right? Should we be using msFree?

Also, if the hash table is empty, why is it an error?

tbonfort commented 12 years ago

Author: hobu Date: 2007/08/04 - 04:55 34f110bc770c9b65e360b8d8fb52f16626943806 (r6459) just hops out of the function if the table is empty. Please revert if this is incorrect.

tbonfort commented 12 years ago

Author: sdlime Date: 2007/08/04 - 16:52 I applied the msHashIsEmpty check in mapfile.c so that empty metadata blocks are not output.

One question, is there any benefit to implementing msHashIsEmpty as a macro as opposed to a function? Just wondering from a programming convention.

Howard, regarding changes in 34f110bc770c9b65e360b8d8fb52f16626943806 (r6459), I moved the empty table check inside the if (table) check and that won't trigger an error. I did leave the other check on table->items just in case and it throws a more specific error (something is really screwed up if that ever showed up). Also changed to msFree's for the key/value un-allocations. 36a52922c680b5a60e49c4e4dcd6cd8f484490cc (r6461)

Marking as fixed.

Steve