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 ; LINKFLAGS += -rdynamic ;
if $(MSPACES) {
CCFLAGS += -DMSPACES ;
C++FLAGS += -DMSPACES ;
}
if ! $(HAVE_LUA) { if ! $(HAVE_LUA) {
HAVE_LUA = 1 ; HAVE_LUA = 1 ;
} }

View File

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

View File

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

View File

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

View File

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