ifdef enclosure of doug lea malloc

This commit is contained in:
Enno Rehling 2005-06-12 10:56:18 +00:00
parent 70413bb43c
commit 71dee49bbb
5 changed files with 32 additions and 24 deletions

View File

@ -5,6 +5,11 @@ CC = gcc ;
LINKFLAGS += -rdynamic ;
if $(MSPACES) {
CCFLAGS += -DMSPACES ;
C++FLAGS += -DMSPACES ;
}
if ! $(HAVE_LUA) {
HAVE_LUA = 1 ;
}

View File

@ -2470,19 +2470,19 @@ attrib_type at_guard = {
void
setguard(unit * u, unsigned int flags)
{
/* setzt die guard-flags der Einheit */
attrib * a = NULL;
/* setzt die guard-flags der Einheit */
attrib * a = NULL;
if (fval(u, UFL_GUARD)) {
a = a_find(u->attribs, &at_guard);
}
if (flags == GUARD_NONE) {
if (flags == GUARD_NONE) {
freset(u, UFL_GUARD);
if (a) a_remove(&u->attribs, a);
return;
}
if (a) a_remove(&u->attribs, a);
return;
}
fset(u, UFL_GUARD);
if (!a) a = a_add(&u->attribs, a_new(&at_guard));
a->data.i = (int)flags;
if (!a) a = a_add(&u->attribs, a_new(&at_guard));
a->data.i = (int)flags;
}
unsigned int

View File

@ -40,7 +40,7 @@
#include <attributes/moved.h>
/* util includes */
#include <base36.h>
#include <util/base36.h>
#include <event.h>
#include <goodies.h>
#include <resolve.h>
@ -56,7 +56,6 @@
#define FIND_FOREIGN_TEMP
int demonfix = 0;
/* ------------------------------------------------------------- */
const unit *
u_peasants(void)
@ -911,20 +910,20 @@ remove_skill(unit *u, skill_t sk)
skill *
add_skill(unit * u, skill_t id)
{
skill * sv = u->skills;
skill * sv = u->skills;
#ifndef NDEBUG
for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
assert(sv->id != id);
}
for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
assert(sv->id != id);
}
#endif
++u->skill_size;
u->skills = realloc(u->skills, u->skill_size * sizeof(skill));
sv = (u->skills + u->skill_size - 1);
sv->level = (unsigned char)0;
sv->weeks = (unsigned char)1;
sv->old = (unsigned char)0;
sv->id = (unsigned char)id;
return sv;
++u->skill_size;
u->skills = realloc(u->skills, u->skill_size * sizeof(skill));
sv = (u->skills + u->skill_size - 1);
sv->level = (unsigned char)0;
sv->weeks = (unsigned char)1;
sv->old = (unsigned char)0;
sv->id = (unsigned char)id;
return sv;
}
skill *

View File

@ -9,7 +9,7 @@ SEARCH_SOURCE +=
[ FDirName $(SUBDIR) dl ] ;
SOURCES =
#<dl>malloc.c
<dl>malloc.c
attrib.c
base36.c
command.c

View File

@ -87,7 +87,9 @@
#include <util/log.h>
#include <util/rand.h>
#include <util/sql.h>
#include <util/dl/malloc.h>
#ifdef MSPACES
# include <util/dl/malloc.h>
#endif
/* lua includes */
#include "lua/bindings.h"
@ -701,7 +703,9 @@ main(int argc, char *argv[])
}
#endif
}
#ifdef MSPACES
malloc_stats();
#endif
#ifdef CLEANUP_CODE
game_done();
#endif