Follow-up Comment #20, bug #18087 (project freeciv):
>> I only noticed one [memory leak]: in sg_load_map_known()),
>> SAVE_MAP_CHAR() -> sg_failure_ret() -> sg_check_ret() can
>> return prematurely.
> I will try to find a way to handle such cases. Would it help to
> add a (possible) goto action to the macro, i.e goto CLEANUP?
Having a standard "goto CLEANUP" would oblige every direct or indirect caller
to have a CLEANUP label, and perhaps limit you to one use of this stuff per
function, neither of which is likely to be acceptable. I'm not 100% sure what
the answer is; probably something like adding a "cleanup" argument to the
macro, which is executed as code before returning, and into which you'd put
Anyway, I've raised bug #18347 about this.
> It is only needed if the map size is increased further (patch 3).
Thanks for confirming.
> Is there something like #error? It could stop compilation if
> the check fails ...
#if/#error looks like the right thing (and would probably work in this case)
but often it's subtly wrong or annoyingly incapable (no sizeof, etc).
I've raised patch #2811 for a non-preprocessor static assert mechanism.
Reply to this item at:
Message sent via/by Gna!
Freeciv-dev mailing list