Project

General

Profile

Actions

Feature #2206

open

Removal of FC_FREE()

Added by Marko Lindqvist about 2 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
09/01/2026
Due date:
% Done:

0%

Estimated time:

Description

I guess FC_FREE() is supposed to be handy, and even useful tool for making sure freed pointers get nullified.

I don't like it.
Problems include:
- It evaluates its parameter twice (e.g. risk of "FC_FREE(array[index++])", among others)
- It gives false sense of security, when there's some more relevant pointer to nullify than one to pass to FC_FREE()
- In some cases it prevents analysis tools from detecting errors they would otherwise detect, or to produce less accurate info

It's also not consistently used, but plain free() is more common in the freeciv codebase. I suggest we get rid of it. This is a metaticket towards that goal.

No data to display

Actions

Also available in: Atom PDF