Ein bischen aufraeumen am Schluss kann nicht wehtun. Nicht doll.

This commit is contained in:
Enno Rehling 2005-05-07 13:38:46 +00:00
parent d7cf8ccc6a
commit b4acb828d7
5 changed files with 53 additions and 27 deletions

View File

@ -8,7 +8,12 @@ if ! $(HAVE_LUA) {
}
if ! $(DISTCC_HOSTS) {
} else {
}
else {
DISTCC = 1 ;
}
if $(DISTCC) {
CC = distcc $(CC) ;
C++ = distcc $(C++) ;
Echo Compiling with distcc ;
@ -24,6 +29,7 @@ if ! $(CCACHE_DIR) {
if $(DMALLOC) {
Echo Compiling with dmalloc ;
CCFLAGS += -DUSE_DMALLOC ;
C++FLAGS += -DUSE_DMALLOC ;
LINKFLAGS += -ldmalloc ;
}

View File

@ -350,6 +350,19 @@ cmistake(const unit * u, struct order *ord, int mno, int mtype)
extern unsigned int new_hashstring(const char* s);
void
free_messagelist(message_list * msgs)
{
struct mlist ** mlistptr = &msgs->begin;
while (*mlistptr) {
struct mlist * ml = *mlistptr;
*mlistptr = ml->next;
msg_release(ml->msg);
free(ml);
}
free(msgs);
}
message *
add_message(message_list** pm, message * m)
{

View File

@ -28,16 +28,17 @@ struct msglevel;
struct message_type;
typedef struct message_list {
struct mlist {
struct mlist * next;
struct message *msg;
} * begin, **end;
struct mlist {
struct mlist * next;
struct message *msg;
} * begin, **end;
} message_list;
typedef struct messageclass
{
struct messageclass * next;
const char * name;
extern void free_messagelist(message_list * msgs);
typedef struct messageclass {
struct messageclass * next;
const char * name;
} messageclass;
typedef struct msglevel {

View File

@ -797,12 +797,30 @@ freeland(land_region * lr)
void
free_region(region * r)
{
runhash(r);
if (last == r) last = NULL;
free(r->display);
if (r->land) freeland(r->land);
while (r->attribs) a_remove (&r->attribs, r->attribs);
free(r);
runhash(r);
if (last == r) last = NULL;
free(r->display);
if (r->land) freeland(r->land);
if (r->msgs) {
free_messagelist(r->msgs);
r->msgs = 0;
}
while (r->individual_messages) {
struct individual_message * msg = r->individual_messages;
r->individual_messages = msg->next;
free_messagelist(msg->msgs);
free(msg);
}
while (r->attribs) a_remove (&r->attribs, r->attribs);
while (r->resources) {
rawmaterial * res = r->resources;
r->resources = res->next;
free(res);
}
free(r);
}
static char *

View File

@ -414,18 +414,6 @@ game_done(void)
region *r = regions;
regions = r->next;
if (r->msgs) {
message_list::mlist ** mlistptr = &r->msgs->begin;
while (*mlistptr) {
message_list::mlist * ml = *mlistptr;
*mlistptr = ml->next;
msg_release(ml->msg);
free(ml);
}
free(r->msgs);
r->msgs = 0;
}
while (r->units) {
unit * u = r->units;
r->units = u->next;