forked from github/server
free configuration data (valgrind calls it still-reachable leaks).
This commit is contained in:
parent
dd2f146e27
commit
dda845e2f4
9 changed files with 44 additions and 24 deletions
|
@ -14,23 +14,27 @@
|
||||||
#include <triggers/triggers.h>
|
#include <triggers/triggers.h>
|
||||||
#include <util/language.h>
|
#include <util/language.h>
|
||||||
#include <util/functions.h>
|
#include <util/functions.h>
|
||||||
#include <kernel/xmlreader.h>
|
|
||||||
#include <kernel/item.h>
|
|
||||||
#include <kernel/curse.h>
|
|
||||||
#include <kernel/building.h>
|
#include <kernel/building.h>
|
||||||
|
#include <kernel/curse.h>
|
||||||
|
#include <kernel/equipment.h>
|
||||||
|
#include <kernel/item.h>
|
||||||
|
#include <kernel/xmlreader.h>
|
||||||
#include <modules/gmcmd.h>
|
#include <modules/gmcmd.h>
|
||||||
#include <modules/xmas.h>
|
#include <modules/xmas.h>
|
||||||
#include <items/itemtypes.h>
|
#include <items/itemtypes.h>
|
||||||
#include <attributes/attributes.h>
|
#include <attributes/attributes.h>
|
||||||
|
#include <util/message.h>
|
||||||
#include <races/races.h>
|
#include <races/races.h>
|
||||||
|
|
||||||
#include "chaos.h"
|
#include "chaos.h"
|
||||||
#include "report.h"
|
|
||||||
#include "items.h"
|
|
||||||
#include "creport.h"
|
#include "creport.h"
|
||||||
|
#include "items.h"
|
||||||
#include "jsreport.h"
|
#include "jsreport.h"
|
||||||
#include "names.h"
|
#include "names.h"
|
||||||
#include "wormhole.h"
|
#include "report.h"
|
||||||
|
#include "reports.h"
|
||||||
#include "spells.h"
|
#include "spells.h"
|
||||||
|
#include "wormhole.h"
|
||||||
|
|
||||||
void game_done(void)
|
void game_done(void)
|
||||||
{
|
{
|
||||||
|
@ -51,6 +55,9 @@ void game_done(void)
|
||||||
free_functions();
|
free_functions();
|
||||||
free_config();
|
free_config();
|
||||||
free_locales();
|
free_locales();
|
||||||
|
message_done();
|
||||||
|
equipment_done();
|
||||||
|
reports_done();
|
||||||
curses_done();
|
curses_done();
|
||||||
kernel_done();
|
kernel_done();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1080,7 +1080,6 @@ void free_gamedata(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
free_donations();
|
free_donations();
|
||||||
free_equipment();
|
|
||||||
|
|
||||||
for (i = 0; i != MAXLOCALES; ++i) {
|
for (i = 0; i != MAXLOCALES; ++i) {
|
||||||
if (defaults[i]) {
|
if (defaults[i]) {
|
||||||
|
@ -1094,15 +1093,15 @@ void free_gamedata(void)
|
||||||
free_borders();
|
free_borders();
|
||||||
free_alliances();
|
free_alliances();
|
||||||
|
|
||||||
|
while (global.attribs) {
|
||||||
|
a_remove(&global.attribs, global.attribs);
|
||||||
|
}
|
||||||
|
|
||||||
while (planes) {
|
while (planes) {
|
||||||
plane *pl = planes;
|
plane *pl = planes;
|
||||||
planes = planes->next;
|
planes = planes->next;
|
||||||
free_plane(pl);
|
free_plane(pl);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (global.attribs) {
|
|
||||||
a_remove(&global.attribs, global.attribs);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * game_name(void) {
|
const char * game_name(void) {
|
||||||
|
|
|
@ -224,7 +224,7 @@ void equip_items(struct item **items, const struct equipment *eq)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_equipment(void) {
|
void equipment_done(void) {
|
||||||
equipment **eqp = &equipment_sets;
|
equipment **eqp = &equipment_sets;
|
||||||
while (*eqp) {
|
while (*eqp) {
|
||||||
equipment *eq = *eqp;
|
equipment *eq = *eqp;
|
||||||
|
|
|
@ -54,6 +54,8 @@ extern "C" {
|
||||||
void(*callback) (const struct equipment *, struct unit *);
|
void(*callback) (const struct equipment *, struct unit *);
|
||||||
} equipment;
|
} equipment;
|
||||||
|
|
||||||
|
void equipment_done(void);
|
||||||
|
|
||||||
struct equipment *create_equipment(const char *eqname);
|
struct equipment *create_equipment(const char *eqname);
|
||||||
struct equipment *get_equipment(const char *eqname);
|
struct equipment *get_equipment(const char *eqname);
|
||||||
|
|
||||||
|
@ -75,7 +77,6 @@ extern "C" {
|
||||||
int mask);
|
int mask);
|
||||||
void equip_items(struct item **items, const struct equipment *eq);
|
void equip_items(struct item **items, const struct equipment *eq);
|
||||||
|
|
||||||
void free_equipment(void);
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2547,13 +2547,6 @@ static void update_find(void)
|
||||||
initial = false;
|
initial = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool kann_finden(faction * f1, faction * f2)
|
|
||||||
{
|
|
||||||
update_find();
|
|
||||||
return (bool)(can_find(f1, f2) != NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/******* end summary ******/
|
|
||||||
|
|
||||||
void register_nr(void)
|
void register_nr(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1094,6 +1094,15 @@ void register_reporttype(const char *extension, report_fun write, int flag)
|
||||||
report_types = type;
|
report_types = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reports_done(void) {
|
||||||
|
report_type **rtp = &report_types;
|
||||||
|
while (*rtp) {
|
||||||
|
report_type *rt = *rtp;
|
||||||
|
*rtp = rt->next;
|
||||||
|
free(rt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static quicklist *get_regions_distance(region * root, int radius)
|
static quicklist *get_regions_distance(region * root, int radius)
|
||||||
{
|
{
|
||||||
quicklist *ql, *rlist = NULL;
|
quicklist *ql, *rlist = NULL;
|
||||||
|
|
|
@ -44,8 +44,8 @@ extern "C" {
|
||||||
extern bool noreports;
|
extern bool noreports;
|
||||||
extern const char *visibility[];
|
extern const char *visibility[];
|
||||||
|
|
||||||
/* kann_finden speedups */
|
void reports_done(void);
|
||||||
bool kann_finden(struct faction *f1, struct faction *f2);
|
|
||||||
struct unit *can_find(struct faction *, struct faction *);
|
struct unit *can_find(struct faction *, struct faction *);
|
||||||
|
|
||||||
/* funktionen zum schreiben eines reports */
|
/* funktionen zum schreiben eines reports */
|
||||||
|
|
|
@ -32,7 +32,7 @@ const char *mt_name(const message_type * mtype)
|
||||||
return mtype->name;
|
return mtype->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
arg_type *argtypes = NULL;
|
static arg_type *argtypes = NULL;
|
||||||
|
|
||||||
void
|
void
|
||||||
register_argtype(const char *name, void(*free_arg) (variant),
|
register_argtype(const char *name, void(*free_arg) (variant),
|
||||||
|
@ -246,3 +246,12 @@ struct message *msg_addref(struct message *msg)
|
||||||
++msg->refcount;
|
++msg->refcount;
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void message_done(void) {
|
||||||
|
arg_type **atp = &argtypes;
|
||||||
|
while (*atp) {
|
||||||
|
arg_type *at = *atp;
|
||||||
|
*atp = at->next;
|
||||||
|
free(at);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -40,8 +40,10 @@ extern "C" {
|
||||||
int refcount;
|
int refcount;
|
||||||
} message;
|
} message;
|
||||||
|
|
||||||
|
void message_done(void);
|
||||||
|
|
||||||
void mt_clear(void);
|
void mt_clear(void);
|
||||||
struct message_type *mt_new(const char *name, const char **args);
|
struct message_type *mt_new(const char *name, const char *args[]);
|
||||||
struct message_type *mt_new_va(const char *name, ...);
|
struct message_type *mt_new_va(const char *name, ...);
|
||||||
/* mt_new("simple_sentence", "subject:string", "predicate:string",
|
/* mt_new("simple_sentence", "subject:string", "predicate:string",
|
||||||
* "object:string", "lang:locale", NULL); */
|
* "object:string", "lang:locale", NULL); */
|
||||||
|
|
Loading…
Reference in a new issue