Skip to content

Commit

Permalink
fix inifile and tolua builds
Browse files Browse the repository at this point in the history
remove our custom assert header
  • Loading branch information
ennorehling committed Feb 14, 2021
1 parent 232c00a commit e96cfcf
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 31 deletions.
4 changes: 2 additions & 2 deletions src/battle.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include "attributes/otherfaction.h"

/* util includes */
#include "util/assert.h"
#include "kernel/attrib.h"
#include "util/base36.h"
#include "util/language.h"
Expand All @@ -60,6 +59,7 @@
#include <selist.h>

/* libc includes */
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
Expand Down Expand Up @@ -194,7 +194,7 @@ void battle_message_faction(battle * b, faction * f, struct message *m)
assert(f);
if (f->battles == NULL || f->battles->r != r) {
struct bmsg *bm = (struct bmsg *)calloc(1, sizeof(struct bmsg));
assert_alloc(bm);
assert(bm);
bm->next = f->battles;
f->battles = bm;
bm->r = r;
Expand Down
5 changes: 2 additions & 3 deletions src/kernel/region.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <spells/regioncurse.h>

/* util includes */
#include <util/assert.h>
#include <kernel/attrib.h>
#include <kernel/gamedata.h>
#include <util/strings.h>
Expand Down Expand Up @@ -698,7 +697,7 @@ void r_setdemand(region * r, const luxury_type * ltype, int value)
d = *dp;
if (!d) {
d = *dp = malloc(sizeof(struct demand));
assert_alloc(d);
assert(d);
d->next = NULL;
d->type = ltype;
}
Expand Down Expand Up @@ -763,7 +762,7 @@ int rsettrees(const region * r, int ageclass, int value)
region *region_create(int uid)
{
region *r = (region *)calloc(1, sizeof(region));
assert_alloc(r);
assert(r);
r->uid = uid;
rhash_uid(r);
return r;
Expand Down
1 change: 0 additions & 1 deletion src/kernel/save.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include <triggers/shock.h>

/* util includes */
#include <util/assert.h>
#include <kernel/attrib.h>
#include <util/base36.h>
#include <kernel/event.h>
Expand Down
6 changes: 3 additions & 3 deletions src/move.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
#include "skill.h"

/* util includes */
#include <util/assert.h>
#include <util/base36.h>
#include <util/language.h>
#include <util/lists.h>
Expand All @@ -70,6 +69,7 @@
#include <storage.h>

/* libc includes */
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down Expand Up @@ -112,7 +112,7 @@ get_followers(unit * u, region * r, const region_list * route_end,
while (a) {
if (a->data.v == u) {
follower *fnew = (follower *)malloc(sizeof(follower));
assert_alloc(fnew);
assert(fnew);
fnew->uf = uf;
fnew->ut = u;
fnew->route_end = route_end;
Expand Down Expand Up @@ -1483,7 +1483,7 @@ static void var_create_regions(arg_regions *dst, const region_list * begin, int
assert(size > 0);
dst->nregions = size;
dst->regions = (region **) malloc(sizeof(region *) * (size_t)size);
assert_alloc(dst->regions);
assert(dst->regions);
for (i = 0, rsrc = begin; i != size; rsrc = rsrc->next, ++i) {
dst->regions[i] = rsrc->data;
}
Expand Down
4 changes: 2 additions & 2 deletions src/spells.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
#include <kernel/unit.h>

/* util includes */
#include <util/assert.h>
#include <kernel/attrib.h>
#include <util/base36.h>
#include <kernel/event.h>
Expand All @@ -81,6 +80,7 @@
#include <storage.h>

/* libc includes */
#include <assert.h>
#include <ctype.h>
#include <math.h>
#include <stdio.h>
Expand Down Expand Up @@ -1269,7 +1269,7 @@ add_ironweapon(const struct item_type *type, const struct item_type *rusty,
float chance)
{
iron_weapon *iweapon = malloc(sizeof(iron_weapon));
assert_alloc(iweapon);
assert(iweapon);
iweapon->type = type;
iweapon->rusty = rusty;
iweapon->chance = chance;
Expand Down
6 changes: 3 additions & 3 deletions src/tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
#include "util/stats.h"
#include "util/param.h"
#include "util/rand.h"
#include "util/assert.h"

#include <CuTest.h>

#include <assert.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -367,7 +367,7 @@ ship_type * test_create_shiptype(const char * name)
stype->damage = 1;
if (!stype->construction) {
stype->construction = calloc(1, sizeof(construction));
assert_alloc(stype->construction);
assert(stype->construction);
stype->construction->maxsize = 5;
stype->construction->minskill = 1;
stype->construction->reqsize = 1;
Expand Down Expand Up @@ -448,7 +448,7 @@ spell * test_create_spell(void)
sp = create_spell("testspell");

sp->components = (spell_component *)calloc(4, sizeof(spell_component));
assert_alloc(sp->components);
assert(sp->components);
sp->components[0].amount = 1;
sp->components[0].type = get_resourcetype(R_SILVER);
sp->components[0].cost = SPC_FIX;
Expand Down
7 changes: 0 additions & 7 deletions src/util/assert.h

This file was deleted.

4 changes: 2 additions & 2 deletions src/util/base36.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "base36.h"
#include "log.h"

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
Expand Down Expand Up @@ -78,7 +78,7 @@ const char *itoab_r(int i, int base, char *s, size_t len)
}
}
else {
log_error("static buffer exhausted, itoab(%d, %d)", i, base);
fprintf(stderr, "static buffer exhausted, itoab(%d, %d)", i, base);
assert(i == 0 || !"itoab: static buffer exhausted");
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/util/language.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ locale *get_or_create_locale(const char *name)
}
}
*lp = l = (locale *)calloc(1, sizeof(locale));
assert_alloc(l);
assert(l);
l->hashkey = hkey;
l->name = str_strdup(name);
l->index = nextlocaleindex++;
Expand Down
2 changes: 0 additions & 2 deletions src/util/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#include "strings.h"
#include "unicode.h"

#include <critbit.h>

#include <assert.h>
#include <errno.h>
#include <limits.h>
Expand Down
4 changes: 2 additions & 2 deletions src/util/translation.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void opstack_push(opstack ** stackp, variant data)
opstack *stack = *stackp;
if (stack == NULL) {
stack = (opstack *)malloc(sizeof(opstack));
assert_alloc(stack);
assert(stack);
stack->size = 2;
stack->begin = malloc(sizeof(variant) * stack->size);
stack->top = stack->begin;
Expand All @@ -52,7 +52,7 @@ void opstack_push(opstack ** stackp, variant data)
void *tmp;
stack->size += stack->size;
tmp = realloc(stack->begin, sizeof(variant) * stack->size);
assert_alloc(tmp);
assert(tmp);
stack->begin = (variant *)tmp;
stack->top = stack->begin + pos;
}
Expand Down
2 changes: 1 addition & 1 deletion src/util/umlaut.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void addtoken(tnode ** root, const char *str, variant id)
index = lcs % NODEHASHSIZE;
#endif
ref = (tref *)malloc(sizeof(tref));
assert_alloc(ref);
assert(ref);
ref->wc = lcs;
ref->node = node;
++node->refcount;
Expand Down
2 changes: 1 addition & 1 deletion tolua
Submodule tolua updated 2 files
+1 −1 src/bin/Makefile
+1 −5 src/bin/tolua.c
5 changes: 4 additions & 1 deletion tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ target_include_directories (inifile PRIVATE ${IniParser_INCLUDE_DIRS})

add_executable(gethash gethash.c)

add_executable(atoi36 atoi36.c ${CMAKE_SOURCE_DIR}/src/util/base36.c)
add_executable(atoi36
atoi36.c
${CMAKE_SOURCE_DIR}/src/util/base36.c
)
target_include_directories(atoi36 PRIVATE ${CMAKE_SOURCE_DIR}/src/util)

0 comments on commit e96cfcf

Please sign in to comment.