From 7358c48580070e3d6e44b3c3a26b21d759b17882 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 11 Apr 2014 19:20:20 -0700 Subject: [PATCH] removing some naming conflicts that hapen when trying to re-enable amalgamation builds. --- src/bind_gmtool.c | 4 +-- src/creport.c | 2 +- src/gmtool.c | 4 +-- src/items.c | 2 +- src/items/demonseye.c | 4 +-- src/items/speedsail.c | 4 +-- src/kernel/config.h | 2 +- src/kernel/connection.c | 65 +++++++++++++++++------------------- src/kernel/curse.c | 8 ++--- src/kernel/item.c | 12 +++---- src/kernel/message.c | 4 +-- src/kernel/reports.c | 4 +-- src/kernel/resources.c | 2 +- src/kernel/ship.c | 12 +++---- src/kernel/unit.c | 2 +- src/market.c | 2 -- src/modules/arena.c | 16 ++++----- src/modules/museum.c | 6 ++-- src/platform.h | 2 +- src/spells/borders.c | 6 ++-- src/spells/buildingcurse.c | 2 +- src/spells/regioncurse.c | 28 ++++++++-------- src/spells/shipcurse.c | 6 ++-- src/spells/spells.c | 2 +- src/spells/unitcurse.c | 16 ++++----- src/tests.h | 3 +- src/triggers/changefaction.c | 2 +- src/triggers/changerace.c | 2 +- src/triggers/clonedied.c | 2 +- src/triggers/createcurse.c | 2 +- src/triggers/createunit.c | 2 +- src/triggers/gate.c | 2 +- src/triggers/giveitem.c | 2 +- src/triggers/killunit.c | 2 +- src/triggers/removecurse.c | 2 +- src/triggers/shock.c | 2 +- src/triggers/timeout.c | 2 +- src/triggers/unguard.c | 2 +- src/triggers/unitmessage.c | 2 +- src/util/crmessage.c | 10 +++--- src/util/parser.c | 50 +++++++++++++-------------- src/util/translation.c | 12 +++---- 42 files changed, 154 insertions(+), 164 deletions(-) diff --git a/src/bind_gmtool.c b/src/bind_gmtool.c index f381318cf..d1111f16a 100644 --- a/src/bind_gmtool.c +++ b/src/bind_gmtool.c @@ -132,14 +132,14 @@ static int tolua_selected_regions(lua_State * L) static int tolua_state_open(lua_State * L) { - unused(L); + unused_arg(L); state_open(); return 0; } static int tolua_state_close(lua_State * L) { - unused(L); + unused_arg(L); state_close(current_state); return 0; } diff --git a/src/creport.c b/src/creport.c index fd49853f5..304031b40 100644 --- a/src/creport.c +++ b/src/creport.c @@ -346,7 +346,7 @@ static int cr_alliance(variant var, char *buffer, const void *userdata) if (al != NULL) { sprintf(buffer, "%d", al->id); } - unused(userdata); + unused_arg(userdata); return 0; } diff --git a/src/gmtool.c b/src/gmtool.c index 6e71ec4d2..26d913872 100644 --- a/src/gmtool.c +++ b/src/gmtool.c @@ -368,7 +368,7 @@ static void paint_info_region(window * wnd, const state * st) int line = 0, maxline = getmaxy(win) - 2; map_region *mr = cursor_region(&st->display, &st->cursor); - unused(st); + unused_arg(st); werase(win); wxborder(win); if (mr && mr->r) { @@ -1276,7 +1276,7 @@ int curses_readline(struct lua_State *L, char *buffer, size_t size, const char *prompt) { - unused(L); + unused_arg(L); askstring(hstatus, prompt, buffer, size); return buffer[0] != 0; } diff --git a/src/items.c b/src/items.c index 410b05427..3bee2c18f 100644 --- a/src/items.c +++ b/src/items.c @@ -119,7 +119,7 @@ use_antimagiccrystal(unit * u, const struct item_type *itype, int amount, float force; spell *sp = find_spell("antimagiczone"); attrib **ap = &r->attribs; - unused(ord); + unused_arg(ord); assert(sp); /* Reduziert die Stärke jedes Spruchs um effect */ diff --git a/src/items/demonseye.c b/src/items/demonseye.c index 53a06bd59..20c0901cc 100644 --- a/src/items/demonseye.c +++ b/src/items/demonseye.c @@ -39,8 +39,8 @@ summon_igjarjuk(struct unit *u, const struct item_type *itype, int amount, struct order *ord) { struct plane *p = rplane(u->region); - unused(amount); - unused(itype); + unused_arg(amount); + unused_arg(itype); if (p != NULL) { ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "use_realworld_only", "")); return EUNUSABLE; diff --git a/src/items/speedsail.c b/src/items/speedsail.c index cc7cff3e3..00b31b41b 100644 --- a/src/items/speedsail.c +++ b/src/items/speedsail.c @@ -42,8 +42,8 @@ use_speedsail(struct unit *u, const struct item_type *itype, int amount, struct order *ord) { struct plane *p = rplane(u->region); - unused(amount); - unused(itype); + unused_arg(amount); + unused_arg(itype); if (p != NULL) { ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "use_realworld_only", "")); } else { diff --git a/src/kernel/config.h b/src/kernel/config.h index 2e6008017..f4b2ceff6 100644 --- a/src/kernel/config.h +++ b/src/kernel/config.h @@ -267,7 +267,7 @@ extern "C" { int ispresent(const struct faction *f, const struct region *r); int check_option(struct faction *f, int option); - extern void parse(keyword_t kword, int (*dofun) (struct unit *, + extern void parse_kwd(keyword_t kword, int (*dofun) (struct unit *, struct order *), bool thisorder); /* Anzahl Personen in einer Einheit festlegen. NUR (!) mit dieser Routine, diff --git a/src/kernel/connection.c b/src/kernel/connection.c index 9d72a6502..a4bee776b 100644 --- a/src/kernel/connection.c +++ b/src/kernel/connection.c @@ -230,31 +230,29 @@ void b_write(const connection * b, storage * store) bool b_transparent(const connection * b, const struct faction *f) { - unused(b); - unused(f); + unused_arg(b); + unused_arg(f); return true; } bool b_opaque(const connection * b, const struct faction * f) { - unused(b); - unused(f); + unused_arg(b); + unused_arg(f); return false; } bool b_blockall(const connection * b, const unit * u, const region * r) { - unused(u); - unused(r); - unused(b); + unused_arg(u); + unused_arg(r); + unused_arg(b); return true; } bool b_blocknone(const connection * b, const unit * u, const region * r) { - unused(u); - unused(r); - unused(b); + unused_arg((u, r, b)); return false; } @@ -266,39 +264,36 @@ bool b_rvisible(const connection * b, const region * r) bool b_fvisible(const connection * b, const struct faction * f, const region * r) { - unused(r); - unused(f); - unused(b); + unused_arg(r, f, b); return true; } bool b_uvisible(const connection * b, const unit * u) { - unused(u); - unused(b); + unused_arg(u, b); return true; } bool b_rinvisible(const connection * b, const region * r) { - unused(r); - unused(b); + unused_arg(r); + unused_arg(b); return false; } bool b_finvisible(const connection * b, const struct faction * f, const region * r) { - unused(r); - unused(f); - unused(b); + unused_arg(r); + unused_arg(f); + unused_arg(b); return false; } bool b_uinvisible(const connection * b, const unit * u) { - unused(u); - unused(b); + unused_arg(u); + unused_arg(b); return false; } @@ -352,9 +347,9 @@ static const char *b_namewall(const connection * b, const region * r, { const char *bname = "wall"; - unused(f); - unused(r); - unused(b); + unused_arg(f); + unused_arg(r); + unused_arg(b); if (gflags & GF_ARTICLE) bname = "a_wall"; if (gflags & GF_PURE) @@ -393,9 +388,9 @@ border_type bt_noway = { static const char *b_namefogwall(const connection * b, const region * r, const struct faction *f, int gflags) { - unused(f); - unused(b); - unused(r); + unused_arg(f); + unused_arg(b); + unused_arg(r); if (gflags & GF_PURE) return "fogwall"; if (gflags & GF_ARTICLE) @@ -406,8 +401,8 @@ static const char *b_namefogwall(const connection * b, const region * r, static bool b_blockfogwall(const connection * b, const unit * u, const region * r) { - unused(b); - unused(r); + unused_arg(b); + unused_arg(r); if (!u) return true; return (bool) (effskill(u, SK_PERCEPTION) > 4); /* Das ist die alte Nebelwand */ @@ -432,8 +427,8 @@ static const char *b_nameillusionwall(const connection * b, const region * r, const struct faction *f, int gflags) { int fno = b->data.i; - unused(b); - unused(r); + unused_arg(b); + unused_arg(r); if (gflags & GF_PURE) return (f && fno == f->no) ? "illusionwall" : "wall"; if (gflags & GF_ARTICLE) { @@ -475,8 +470,8 @@ static const char *b_namequestportal(const connection * b, const region * r, { const char *bname; int lock = b->data.i; - unused(b); - unused(r); + unused_arg(b); + unused_arg(r); if (gflags & GF_ARTICLE) { if (lock > 0) { @@ -521,7 +516,7 @@ static const char *b_nameroad(const connection * b, const region * r, int local = (r == b->from) ? b->data.sa[0] : b->data.sa[1]; static char buffer[64]; - unused(f); + unused_arg(f); if (gflags & GF_PURE) return "road"; if (gflags & GF_ARTICLE) { diff --git a/src/kernel/curse.c b/src/kernel/curse.c index dd722b828..f5be58b17 100644 --- a/src/kernel/curse.c +++ b/src/kernel/curse.c @@ -56,8 +56,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include -#include - #define MAXENTITYHASH 7919 curse *cursehash[MAXENTITYHASH]; @@ -769,9 +767,9 @@ message *cinfo_simple(const void *obj, objtype_t typ, const struct curse * c, { struct message *msg; - unused(typ); - unused(self); - unused(obj); + unused_arg(typ); + unused_arg(self); + unused_arg(obj); msg = msg_message(mkname("curseinfo", c->type->cname), "id", c->no); if (msg == NULL) { diff --git a/src/kernel/item.c b/src/kernel/item.c index ef7d3eb8f..21346aedf 100644 --- a/src/kernel/item.c +++ b/src/kernel/item.c @@ -635,9 +635,9 @@ use_birthdayamulet(unit * u, const struct item_type *itype, int amount, direction_t d; message *msg = msg_message("meow", ""); - unused(ord); - unused(amount); - unused(itype); + unused_arg(ord); + unused_arg(amount); + unused_arg(itype); add_message(&u->region->msgs, msg); for (d = 0; d < MAXDIRECTIONS; d++) { @@ -676,7 +676,7 @@ use_tacticcrystal(unit * u, const struct item_type *itype, int amount, c = create_curse(u, &u->attribs, ct_find("skillmod"), power, duration, effect, u->number); c->data.i = SK_TACTICS; - unused(ord); + unused_arg(ord); } use_pooled(u, itype->rtype, GET_DEFAULT, amount); ADDMSG(&u->faction->msgs, msg_message("use_tacticcrystal", @@ -714,7 +714,7 @@ mod_elves_only(const unit * u, const region * r, skill_t sk, int value) { if (u_race(u) == new_race[RC_ELF]) return value; - unused(r); + unused_arg(r); return -118; } @@ -723,7 +723,7 @@ mod_dwarves_only(const unit * u, const region * r, skill_t sk, int value) { if (u_race(u) == new_race[RC_DWARF]) return value; - unused(r); + unused_arg(r); return -118; } diff --git a/src/kernel/message.c b/src/kernel/message.c index 001e04004..d5d2aa20c 100644 --- a/src/kernel/message.c +++ b/src/kernel/message.c @@ -201,7 +201,7 @@ caddmessage(region * r, faction * f, const char *s, msg_t mtype, int level) log_warning("message for locale \"%s\": %s\n", locale_name(f->locale), s); } #endif - unused(level); + unused_arg(level); switch (mtype) { case MSG_INCOME: assert(f); @@ -255,7 +255,7 @@ message * cmistake(const unit * u, struct order *ord, int mno, int mtype) { message * result; static char msgname[20]; - unused(mtype); + unused_arg(mtype); if (is_monsters(u->faction)) return 0; diff --git a/src/kernel/reports.c b/src/kernel/reports.c index eccf8500b..f4b0096c0 100644 --- a/src/kernel/reports.c +++ b/src/kernel/reports.c @@ -2127,7 +2127,7 @@ static void eval_order(struct opstack **stack, const void *userdata) size_t len; variant var; - unused(userdata); + unused_arg(userdata); write_order(ord, buf, sizeof(buf)); len = strlen(buf); var.v = strcpy(balloc(len + 1), buf); @@ -2282,7 +2282,7 @@ static void eval_int36(struct opstack **stack, const void *userdata) var.v = strcpy(balloc(len + 1), c); opush(stack, var); - unused(userdata); + unused_arg(userdata); } /*** END MESSAGE RENDERING ***/ diff --git a/src/kernel/resources.c b/src/kernel/resources.c index b883ed1d3..17d07a040 100644 --- a/src/kernel/resources.c +++ b/src/kernel/resources.c @@ -119,7 +119,7 @@ static void terraform_default(struct rawmaterial *res, const region * r) res->amount = (int)(res->amount * modifier); /* random adjustment, +/- 91% */ if (res->amount < 1) res->amount = 1; - unused(r); + unused_arg(r); } #ifdef RANDOM_CHANGE diff --git a/src/kernel/ship.c b/src/kernel/ship.c index c2cc312c4..1af72caf4 100644 --- a/src/kernel/ship.c +++ b/src/kernel/ship.c @@ -102,13 +102,13 @@ void st_register(const ship_type * type) ql_push(&shiptypes, (void *)type); } -#define SMAXHASH 7919 -ship *shiphash[SMAXHASH]; +#define MAXSHIPHASH 7919 +ship *shiphash[MAXSHIPHASH]; void shash(ship * s) { - ship *old = shiphash[s->no % SMAXHASH]; + ship *old = shiphash[s->no % MAXSHIPHASH]; - shiphash[s->no % SMAXHASH] = s; + shiphash[s->no % MAXSHIPHASH] = s; s->nexthash = old; } @@ -116,7 +116,7 @@ void sunhash(ship * s) { ship **show; - for (show = &shiphash[s->no % SMAXHASH]; *show; show = &(*show)->nexthash) { + for (show = &shiphash[s->no % MAXSHIPHASH]; *show; show = &(*show)->nexthash) { if ((*show)->no == s->no) break; } @@ -131,7 +131,7 @@ static ship *sfindhash(int i) { ship *old; - for (old = shiphash[i % SMAXHASH]; old; old = old->nexthash) + for (old = shiphash[i % MAXSHIPHASH]; old; old = old->nexthash) if (old->no == i) return old; return 0; diff --git a/src/kernel/unit.c b/src/kernel/unit.c index 30220f70d..1be61c138 100644 --- a/src/kernel/unit.c +++ b/src/kernel/unit.c @@ -749,7 +749,7 @@ void set_level(unit * u, skill_t sk, int value) static int leftship_age(struct attrib *a) { /* must be aged, so it doesn't affect report generation (cansee) */ - unused(a); + unused_arg(a); return AT_AGE_REMOVE; /* remove me */ } diff --git a/src/market.c b/src/market.c index 2e812e9c0..274872fca 100644 --- a/src/market.c +++ b/src/market.c @@ -28,8 +28,6 @@ without prior permission by the authors of Eressea. #include #include -#include - static unsigned int get_markets(region * r, unit ** results, size_t size) { unsigned int n = 0; diff --git a/src/modules/arena.c b/src/modules/arena.c index 407ee89e0..c9140bb08 100644 --- a/src/modules/arena.c +++ b/src/modules/arena.c @@ -107,9 +107,9 @@ leave_arena(struct unit *u, const struct item_type *itype, int amount, if (u->building != arena_tower(u->faction->magiegebiet) && leave_fail(u)) { return -1; } - unused(amount); - unused(ord); - unused(itype); + unused_arg(amount); + unused_arg(ord); + unused_arg(itype); assert(!"not implemented"); return 0; } @@ -128,9 +128,9 @@ enter_arena(unit * u, const item_type * itype, int amount, order * ord) region *r = u->region; unit *u2; int fee = u->faction->score / 5; - unused(ord); - unused(amount); - unused(itype); + unused_arg(ord); + unused_arg(amount); + unused_arg(itype); if (fee > 2000) fee = 2000; if (getplane(r) == arena) @@ -186,7 +186,7 @@ use_wand_of_tears(unit * user, const struct item_type *itype, int amount, order * ord) { int n; - unused(ord); + unused_arg(ord); for (n = 0; n != amount; ++n) { unit *u; for (u = user->region->units; u; u = u->next) { @@ -432,7 +432,7 @@ static int caldera_handle(trigger * t, void *data) } else { log_error("could not perform caldera::handle()\n"); } - unused(data); + unused_arg(data); return 0; } diff --git a/src/modules/museum.c b/src/modules/museum.c index 61359781f..43b5e7e6e 100644 --- a/src/modules/museum.c +++ b/src/modules/museum.c @@ -306,7 +306,7 @@ use_museumexitticket(unit * u, const struct item_type *itype, int amount, unit *warden = findunit(atoi36("mwar")); int unit_cookie; - unused(amount); + unused_arg(amount); /* Prüfen ob in Eingangshalle */ if (u->region->x != 9525 || u->region->y != 9525) { @@ -362,9 +362,9 @@ use_museumticket(unit * u, const struct item_type *itype, int amount, region *r = u->region; plane *pl = rplane(r); - unused(amount); + unused_arg(amount); - /* Prüfen ob in normaler Plane und nur eine Person */ + /* Prüfen ob in normaler Plane und nur eine Person */ if (pl != get_homeplane()) { cmistake(u, ord, 265, MSG_MAGIC); return 0; diff --git a/src/platform.h b/src/platform.h index 0b9d3efa4..464fed5fa 100644 --- a/src/platform.h +++ b/src/platform.h @@ -78,7 +78,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # define _XOPEN_SOURCE #endif -#define unused (void) +#define unused_arg (void) #ifndef INLINE_FUNCTION # define INLINE_FUNCTION diff --git a/src/spells/borders.c b/src/spells/borders.c index 833dab38d..9f62ad15b 100644 --- a/src/spells/borders.c +++ b/src/spells/borders.c @@ -234,9 +234,9 @@ static const char *b_namefirewall(const connection * b, const region * r, const faction * f, int gflags) { const char *bname; - unused(f); - unused(r); - unused(b); + unused_arg(f); + unused_arg(r); + unused_arg(b); if (gflags & GF_ARTICLE) bname = "a_firewall"; else diff --git a/src/spells/buildingcurse.c b/src/spells/buildingcurse.c index 266cfcf45..dd9cc632e 100644 --- a/src/spells/buildingcurse.c +++ b/src/spells/buildingcurse.c @@ -36,7 +36,7 @@ static message *cinfo_building(const void *obj, objtype_t typ, const curse * c, int self) { - unused(typ); + unused_arg(typ); assert(typ == TYP_BUILDING); if (self != 0) { /* owner or inside */ diff --git a/src/spells/regioncurse.c b/src/spells/regioncurse.c index bf65656a6..14fc7ee5b 100644 --- a/src/spells/regioncurse.c +++ b/src/spells/regioncurse.c @@ -46,8 +46,8 @@ static message *cinfo_cursed_by_the_gods(const void *obj, objtype_t typ, { region *r = (region *) obj; - unused(typ); - unused(self); + unused_arg(typ); + unused_arg(self); assert(typ == TYP_REGION); if (fval(r->terrain, SEA_REGION)) { @@ -69,9 +69,9 @@ static struct curse_type ct_godcursezone = { static message *cinfo_dreamcurse(const void *obj, objtype_t typ, const curse * c, int self) { - unused(self); - unused(typ); - unused(obj); + unused_arg(self); + unused_arg(typ); + unused_arg(obj); assert(typ == TYP_REGION); if (curse_geteffect(c) > 0) { @@ -93,9 +93,9 @@ static struct curse_type ct_gbdream = { static message *cinfo_magicstreet(const void *obj, objtype_t typ, const curse * c, int self) { - unused(typ); - unused(self); - unused(obj); + unused_arg(typ); + unused_arg(self); + unused_arg(obj); assert(typ == TYP_REGION); /* Warnung vor Auflösung */ @@ -116,9 +116,9 @@ static struct curse_type ct_magicstreet = { static message *cinfo_antimagiczone(const void *obj, objtype_t typ, const curse * c, int self) { - unused(typ); - unused(self); - unused(obj); + unused_arg(typ); + unused_arg(self); + unused_arg(obj); assert(typ == TYP_REGION); /* Magier spüren eine Antimagiezone */ @@ -138,7 +138,7 @@ cansee_antimagiczone(const struct faction *viewer, const void *obj, objtype_t ty unit *u = NULL; unit *mage = c->magician; - unused(typ); + unused_arg(typ); assert(typ == TYP_REGION); r = (region *) obj; @@ -166,8 +166,8 @@ static struct curse_type ct_antimagiczone = { static message *cinfo_farvision(const void *obj, objtype_t typ, const curse * c, int self) { - unused(typ); - unused(obj); + unused_arg(typ); + unused_arg(obj); assert(typ == TYP_REGION); diff --git a/src/spells/shipcurse.c b/src/spells/shipcurse.c index 13d7d1e8a..4c23625ba 100644 --- a/src/spells/shipcurse.c +++ b/src/spells/shipcurse.c @@ -40,8 +40,8 @@ message *cinfo_ship(const void *obj, objtype_t typ, const curse * c, int self) { message *msg; - unused(typ); - unused(obj); + unused_arg(typ); + unused_arg(obj); assert(typ == TYP_SHIP); if (self != 0) { /* owner or inside */ @@ -63,7 +63,7 @@ static message *cinfo_shipnodrift(const void *obj, objtype_t typ, const curse * { ship *sh = (ship *) obj; - unused(typ); + unused_arg(typ); assert(typ == TYP_SHIP); if (self != 0) { diff --git a/src/spells/spells.c b/src/spells/spells.c index 504d31d58..d0acc6356 100644 --- a/src/spells/spells.c +++ b/src/spells/spells.c @@ -5569,7 +5569,7 @@ int sp_showastral(castorder * co) free_regionlist(rl); return cast_level; - unused(co); + unused_arg(co); return 0; } #endif diff --git a/src/spells/unitcurse.c b/src/spells/unitcurse.c index b62e10627..8a127f2ce 100644 --- a/src/spells/unitcurse.c +++ b/src/spells/unitcurse.c @@ -48,7 +48,7 @@ static message *cinfo_auraboost(const void *obj, objtype_t typ, const curse * c, int self) { struct unit *u = (struct unit *)obj; - unused(typ); + unused_arg(typ); assert(typ == TYP_UNIT); if (self != 0) { @@ -81,7 +81,7 @@ static message *cinfo_slave(const void *obj, objtype_t typ, const curse * c, int self) { unit *u; - unused(typ); + unused_arg(typ); assert(typ == TYP_UNIT); u = (unit *) obj; @@ -105,7 +105,7 @@ static struct curse_type ct_slavery = { "slavery", static message *cinfo_calm(const void *obj, objtype_t typ, const curse * c, int self) { - unused(typ); + unused_arg(typ); assert(typ == TYP_UNIT); if (c->magician && c->magician->faction) { @@ -134,7 +134,7 @@ static struct curse_type ct_calmmonster = { static message *cinfo_speed(const void *obj, objtype_t typ, const curse * c, int self) { - unused(typ); + unused_arg(typ); assert(typ == TYP_UNIT); if (self != 0) { @@ -157,7 +157,7 @@ static struct curse_type ct_speed = { */ message *cinfo_unit(const void *obj, objtype_t typ, const curse * c, int self) { - unused(typ); + unused_arg(typ); assert(typ == TYP_UNIT); if (self != 0) { @@ -181,7 +181,7 @@ static struct curse_type ct_orcish = { static message *cinfo_kaelteschutz(const void *obj, objtype_t typ, const curse * c, int self) { - unused(typ); + unused_arg(typ); assert(typ == TYP_UNIT); if (self != 0) { @@ -233,7 +233,7 @@ static message *cinfo_sparkle(const void *obj, objtype_t typ, const curse * c, }; int m, begin = 0, end = 0; unit *u; - unused(typ); + unused_arg(typ); assert(typ == TYP_UNIT); u = (unit *) obj; @@ -333,7 +333,7 @@ write_skill(struct storage *store, const curse * c, const void *target) static message *cinfo_skillmod(const void *obj, objtype_t typ, const curse * c, int self) { - unused(typ); + unused_arg(typ); if (self != 0) { unit *u = (unit *) obj; diff --git a/src/tests.h b/src/tests.h index 7ebd903a8..d7b54e75e 100644 --- a/src/tests.h +++ b/src/tests.h @@ -3,8 +3,7 @@ #ifdef __cplusplus extern "C" { #endif - #include - + void test_cleanup(void); struct terrain_type * test_create_terrain(const char * name, unsigned int flags); diff --git a/src/triggers/changefaction.c b/src/triggers/changefaction.c index 3ad35f44a..5339fc2db 100644 --- a/src/triggers/changefaction.c +++ b/src/triggers/changefaction.c @@ -70,7 +70,7 @@ static int changefaction_handle(trigger * t, void *data) } else { log_error("could not perform changefaction::handle()\n"); } - unused(data); + unused_arg(data); return 0; } diff --git a/src/triggers/changerace.c b/src/triggers/changerace.c index f03483a0d..98ff0fcd8 100644 --- a/src/triggers/changerace.c +++ b/src/triggers/changerace.c @@ -73,7 +73,7 @@ static int changerace_handle(trigger * t, void *data) } else { log_error("could not perform changerace::handle()\n"); } - unused(data); + unused_arg(data); return 0; } diff --git a/src/triggers/clonedied.c b/src/triggers/clonedied.c index 652aa9228..e8b28f054 100644 --- a/src/triggers/clonedied.c +++ b/src/triggers/clonedied.c @@ -56,7 +56,7 @@ static int clonedied_handle(trigger * t, void *data) a_remove(&u->attribs, a); } else log_error("could not perform clonedied::handle()\n"); - unused(data); + unused_arg(data); return 0; } diff --git a/src/triggers/createcurse.c b/src/triggers/createcurse.c index 752765af1..43e7ebab7 100644 --- a/src/triggers/createcurse.c +++ b/src/triggers/createcurse.c @@ -76,7 +76,7 @@ static int createcurse_handle(trigger * t, void *data) } else { log_error("could not perform createcurse::handle()\n"); } - unused(data); + unused_arg(data); return 0; } diff --git a/src/triggers/createunit.c b/src/triggers/createunit.c index 5ea487901..ade3fff93 100644 --- a/src/triggers/createunit.c +++ b/src/triggers/createunit.c @@ -74,7 +74,7 @@ static int createunit_handle(trigger * t, void *data) } else { log_error("could not perform createunit::handle()\n"); } - unused(data); + unused_arg(data); return 0; } diff --git a/src/triggers/gate.c b/src/triggers/gate.c index d460d6d49..0c284c3be 100644 --- a/src/triggers/gate.c +++ b/src/triggers/gate.c @@ -57,7 +57,7 @@ static int gate_handle(trigger * t, void *data) log_error("could not perform gate::handle()\n"); return -1; } - unused(data); + unused_arg(data); return 0; } diff --git a/src/triggers/giveitem.c b/src/triggers/giveitem.c index cf8015849..edaae77c5 100644 --- a/src/triggers/giveitem.c +++ b/src/triggers/giveitem.c @@ -69,7 +69,7 @@ static int giveitem_handle(trigger * t, void *data) } else { log_error("could not perform giveitem::handle()\n"); } - unused(data); + unused_arg(data); return 0; } diff --git a/src/triggers/killunit.c b/src/triggers/killunit.c index 450d3ac66..3376d9cc1 100644 --- a/src/triggers/killunit.c +++ b/src/triggers/killunit.c @@ -48,7 +48,7 @@ static int killunit_handle(trigger * t, void *data) /* we can't remove_unit() here, because that's what's calling us. */ set_number(u, 0); } - unused(data); + unused_arg(data); return 0; } diff --git a/src/triggers/removecurse.c b/src/triggers/removecurse.c index 43d2e6f30..f6fcbc659 100644 --- a/src/triggers/removecurse.c +++ b/src/triggers/removecurse.c @@ -68,7 +68,7 @@ static int removecurse_handle(trigger * t, void *data) } else log_error("could not perform removecurse::handle()\n"); } - unused(data); + unused_arg(data); return 0; } diff --git a/src/triggers/shock.c b/src/triggers/shock.c index 550d9a79b..f8768be88 100644 --- a/src/triggers/shock.c +++ b/src/triggers/shock.c @@ -97,7 +97,7 @@ static int shock_handle(trigger * t, void *data) if (u && u->number) { do_shock(u, "trigger"); } - unused(data); + unused_arg(data); return 0; } diff --git a/src/triggers/timeout.c b/src/triggers/timeout.c index d4c11167c..1a336f602 100644 --- a/src/triggers/timeout.c +++ b/src/triggers/timeout.c @@ -61,7 +61,7 @@ static int timeout_handle(trigger * t, void *data) handle_triggers(&td->triggers, NULL); return -1; } - unused(data); + unused_arg(data); return 0; } diff --git a/src/triggers/unguard.c b/src/triggers/unguard.c index 5cdaf63d5..f31d32ece 100644 --- a/src/triggers/unguard.c +++ b/src/triggers/unguard.c @@ -38,7 +38,7 @@ static int unguard_handle(trigger * t, void *data) log_error("could not perform unguard::handle()\n"); return -1; } - unused(data); + unused_arg(data); return 0; } diff --git a/src/triggers/unitmessage.c b/src/triggers/unitmessage.c index cb5e4857b..2b639056f 100644 --- a/src/triggers/unitmessage.c +++ b/src/triggers/unitmessage.c @@ -71,7 +71,7 @@ static int unitmessage_handle(trigger * t, void *data) td->level); } } - unused(data); + unused_arg(data); return 0; } diff --git a/src/util/crmessage.c b/src/util/crmessage.c index f02c8d25d..c6788751d 100644 --- a/src/util/crmessage.c +++ b/src/util/crmessage.c @@ -135,21 +135,21 @@ int cr_render(const message * msg, char *buffer, const void *userdata) int cr_string(variant var, char *buffer, const void *userdata) { sprintf(buffer, "\"%s\"", (const char *)var.v); - unused(userdata); + unused_arg(userdata); return 0; } int cr_int(variant var, char *buffer, const void *userdata) { sprintf(buffer, "%d", var.i); - unused(userdata); + unused_arg(userdata); return 0; } int cr_ignore(variant var, char *buffer, const void *userdata) { - unused(var); - unused(buffer); - unused(userdata); + unused_arg(var); + unused_arg(buffer); + unused_arg(userdata); return -1; } diff --git a/src/util/parser.c b/src/util/parser.c index 4a4ffcc29..4e95be50a 100644 --- a/src/util/parser.c +++ b/src/util/parser.c @@ -18,7 +18,7 @@ typedef struct parser_state { struct parser_state *next; } parser_state; -static parser_state *state; +static parser_state *states; static int eatwhitespace_c(const char **str_p) { @@ -51,12 +51,12 @@ static int eatwhitespace_c(const char **str_p) void init_tokens_str(const char *initstr, char *cmd) { - if (state == NULL) { - state = malloc(sizeof(parser_state)); - } else if (state->current_cmd) - free(state->current_cmd); - state->current_cmd = cmd; - state->current_token = initstr; + if (states == NULL) { + states = malloc(sizeof(parser_state)); + } else if (states->current_cmd) + free(states->current_cmd); + states->current_cmd = cmd; + states->current_token = initstr; } void parser_pushstate(void) @@ -64,44 +64,44 @@ void parser_pushstate(void) parser_state *new_state = malloc(sizeof(parser_state)); new_state->current_cmd = NULL; new_state->current_token = NULL; - new_state->next = state; - state = new_state; + new_state->next = states; + states = new_state; } void parser_popstate(void) { - parser_state *new_state = state->next; - if (state->current_cmd != NULL) - free(state->current_cmd); - free(state); - state = new_state; + parser_state *new_state = states->next; + if (states->current_cmd != NULL) + free(states->current_cmd); + free(states); + states = new_state; } bool parser_end(void) { - eatwhitespace_c(&state->current_token); - return *state->current_token == 0; + eatwhitespace_c(&states->current_token); + return *states->current_token == 0; } void skip_token(void) { char quotechar = 0; - eatwhitespace_c(&state->current_token); + eatwhitespace_c(&states->current_token); - while (*state->current_token) { + while (*states->current_token) { ucs4_t ucs; size_t len; - unsigned char utf8_character = (unsigned char)state->current_token[0]; + unsigned char utf8_character = (unsigned char)states->current_token[0]; if (~utf8_character & 0x80) { ucs = utf8_character; - ++state->current_token; + ++states->current_token; } else { - int ret = unicode_utf8_to_ucs4(&ucs, state->current_token, &len); + int ret = unicode_utf8_to_ucs4(&ucs, states->current_token, &len); if (ret == 0) { - state->current_token += len; + states->current_token += len; } else { - log_warning("illegal character sequence in UTF8 string: %s\n", state->current_token); + log_warning("illegal character sequence in UTF8 string: %s\n", states->current_token); } } if (iswxspace((wint_t) ucs) && quotechar == 0) { @@ -115,7 +115,7 @@ void skip_token(void) quotechar = utf8_character; break; case ESCAPE_CHAR: - ++state->current_token; + ++states->current_token; break; } } @@ -189,5 +189,5 @@ const char *parse_token(const char **str) const char *getstrtoken(void) { - return parse_token((const char **)&state->current_token); + return parse_token((const char **)&states->current_token); } diff --git a/src/util/translation.c b/src/util/translation.c index be4c2bdf9..1c93c0bb2 100644 --- a/src/util/translation.c +++ b/src/util/translation.c @@ -405,7 +405,7 @@ static void eval_lt(opstack ** stack, const void *userdata) int b = opop_i(stack); int rval = (b < a) ? 1 : 0; opush_i(stack, rval); - unused(userdata); + unused_arg(userdata); } static void eval_eq(opstack ** stack, const void *userdata) @@ -414,7 +414,7 @@ static void eval_eq(opstack ** stack, const void *userdata) int b = opop_i(stack); int rval = (a == b) ? 1 : 0; opush_i(stack, rval); - unused(userdata); + unused_arg(userdata); } static void eval_add(opstack ** stack, const void *userdata) @@ -422,14 +422,14 @@ static void eval_add(opstack ** stack, const void *userdata) int a = opop_i(stack); int b = opop_i(stack); opush_i(stack, a + b); - unused(userdata); + unused_arg(userdata); } static void eval_isnull(opstack ** stack, const void *userdata) { /* (int, int) -> int */ void *a = opop_v(stack); opush_i(stack, (a == NULL) ? 1 : 0); - unused(userdata); + unused_arg(userdata); } static void eval_if(opstack ** stack, const void *userdata) @@ -438,14 +438,14 @@ static void eval_if(opstack ** stack, const void *userdata) void *b = opop_v(stack); int cond = opop_i(stack); opush_v(stack, cond ? b : a); - unused(userdata); + unused_arg(userdata); } static void eval_strlen(opstack ** stack, const void *userdata) { /* string -> int */ const char *c = (const char *)opop_v(stack); opush_i(stack, c ? (int)strlen(c) : 0); - unused(userdata); + unused_arg(userdata); } #include "base36.h"