diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-11-03 23:14:35 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-12-05 10:14:25 -0800 |
commit | ab99ca85f12b92ed55219c82ec2220aebfe1dda5 (patch) | |
tree | 6d6710368d194a97465b63cc81220b0557d68917 /core/equipment.c | |
parent | dc67876c7955b21f969545eee6f3ae3bdb550787 (diff) | |
download | subsurface-ab99ca85f12b92ed55219c82ec2220aebfe1dda5.tar.gz |
Cleanup: use free_weightsystem function instead of explicit free
Instead of freeing internal data of the weightsystem structure,
call the free_weightsystem function (which has to be made extern
at first). This makes things more future-proof, should the
weightsystem struct ever be extended.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/equipment.c')
-rw-r--r-- | core/equipment.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/equipment.c b/core/equipment.c index bd1a0b4e3..e7ac327fd 100644 --- a/core/equipment.c +++ b/core/equipment.c @@ -19,9 +19,13 @@ #include "subsurface-string.h" #include "table.h" -static void free_weightsystem(weightsystem_t w) +/* Warning: this has strange semantics for C-code! Not the weightsystem object + * is freed, but the data it references. The object itself is passed in by value. + * This is due to the fact how the table macros work. + */ +void free_weightsystem(weightsystem_t ws) { - free((void *)w.description); + free((void *)ws.description); } static void free_cylinder(cylinder_t c) |