Skip to content

Commit 6f35f24

Browse files
authored
Removes the UNUSED macro. Pointless obscuring of logic. (#159)
1 parent 8de75ee commit 6f35f24

File tree

9 files changed

+35
-36
lines changed

9 files changed

+35
-36
lines changed

src/defines.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@
6565
#define strdup SDL_strdup
6666
#endif // _WIN32
6767

68-
#define UNUSED(x) (void)(x)
69-
7068
#define UNPACK_COLOR(color) color.r, color.g, color.b, color.a
7169
#define C_WHITE (SDL_Color){255, 255, 255, 255}
7270
#define C_RED (SDL_Color){255, 0, 0, 255}

src/gamestate.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ typedef enum GameState_t {
2323
MENU,
2424
CREDITS,
2525
SCORE_SCREEN,
26+
SEED_ENTRY,
2627
PLAYING,
2728
IN_GAME_MENU,
2829
CHARACTER_MENU,

src/hiscore.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ hiscore_get_top10(void)
167167
static int
168168
load_top_gold_cb(void *result, int count, char **values, char **colNames)
169169
{
170-
UNUSED(count);
171-
UNUSED(colNames);
170+
(void)count;
171+
(void)colNames;
172172

173173
double *gold = result;
174174
*gold = atof(values[0]);

src/main.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ startGame(void)
289289
static void
290290
exitGame(void *unused)
291291
{
292-
UNUSED(unused);
292+
(void)unused;
293293
gGameState = QUIT;
294294
}
295295

@@ -302,7 +302,7 @@ gameCompleted(void)
302302
static void
303303
toggleInGameMenu(void *unused)
304304
{
305-
UNUSED(unused);
305+
(void)unused;
306306
if (gGameState == PLAYING || gGameState == GAME_OVER || gGameState == COMPLETED)
307307
gGameState = IN_GAME_MENU;
308308
else if (is_player_dead())
@@ -329,7 +329,7 @@ on_character_select(const char *str)
329329
static void
330330
goToCharacterMenu(void *unused)
331331
{
332-
UNUSED(unused);
332+
(void)unused;
333333
charSelectMenu = menu_create_character_selector(on_character_select, gCamera);
334334
characterSelectScreen = screen_create_characterselect(gRenderer);
335335
gGameState = CHARACTER_MENU;
@@ -423,7 +423,7 @@ startArcadeGame(void *unused)
423423
static void
424424
goToMainMenu(void *unused)
425425
{
426-
UNUSED(unused);
426+
(void)unused;
427427
save_load();
428428
gui_clear_message_log();
429429
gGameState = MENU;
@@ -439,7 +439,7 @@ goToMainMenu(void *unused)
439439
static void
440440
goToGameSelectMenu(void *unused)
441441
{
442-
UNUSED(unused);
442+
(void)unused;
443443
int item_count = 3;
444444
#ifdef STEAM_BUILD
445445
item_count += 1;
@@ -474,7 +474,7 @@ goToGameSelectMenu(void *unused)
474474
static void
475475
showHowToTooltip(void *unused)
476476
{
477-
UNUSED(unused);
477+
(void)unused;
478478
toggleInGameMenu(NULL);
479479
gGui->activeTooltip = tooltip_manager_get_tooltip(TOOLTIP_TYPE_HOWTO);
480480
}
@@ -511,14 +511,14 @@ createInGameGameOverMenu(void)
511511
static void
512512
viewCredits(void *unused)
513513
{
514-
UNUSED(unused);
514+
(void)unused;
515515
gGameState = CREDITS;
516516
}
517517

518518
static void
519519
viewScoreScreen(void *unused)
520520
{
521-
UNUSED(unused);
521+
(void)unused;
522522
gGameState = SCORE_SCREEN;
523523
}
524524

@@ -1381,7 +1381,7 @@ validate_lib_checksum(void)
13811381
int
13821382
main(int argc, char *argv[])
13831383
{
1384-
UNUSED(argc);
1384+
(void)argc;
13851385

13861386
#ifdef CHECKSUM_VALIDATION
13871387
validate_lib_checksum();

src/map_lua.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ l_create_map(lua_State *L)
6363
static int
6464
l_print_info(lua_State *L)
6565
{
66-
UNUSED(L); // Compilers keep warning about L being unused
66+
(void)L; // Compilers keep warning about L being unused
6767
debug(luaL_checkstring(L, 1));
6868
return 0;
6969
}

src/settings.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ create_tables(void)
6969
static int
7070
load_settings_cb(void *unused, int count, char **values, char **colNames)
7171
{
72-
UNUSED(unused);
72+
(void)unused;
7373

7474
int i = 0;
7575
while (i < count) {

src/skill.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ check_skill_validity(Position *playerPos, Position *targetPos, SkillData *data)
333333
static bool
334334
vampiric_blow_skill(Skill *skill, SkillData *data)
335335
{
336-
UNUSED(skill);
336+
(void)skill;
337337

338338
Position playerPos, targetPos;
339339
Player *player = data->player;
@@ -412,7 +412,7 @@ create_vampiric_blow(Camera *cam)
412412
static bool
413413
skill_use_flurry(Skill *skill, SkillData *data)
414414
{
415-
UNUSED(skill);
415+
(void)skill;
416416

417417
Position playerPos, targetPos;
418418
if (!check_skill_validity(&playerPos, &targetPos, data)) {
@@ -489,7 +489,7 @@ skill_throw_dagger_available(Player *player)
489489
static bool
490490
skill_throw_dagger(Skill *skill, SkillData *data)
491491
{
492-
UNUSED(skill);
492+
(void)skill;
493493

494494
if (data->player->daggers == 0)
495495
return false;
@@ -542,7 +542,7 @@ create_throw_dagger(void)
542542
static bool
543543
skill_bash(Skill *skill, SkillData *data)
544544
{
545-
UNUSED(skill);
545+
(void)skill;
546546

547547
Position playerPos, targetPos;
548548
if (!check_skill_validity(&playerPos, &targetPos, data)) {
@@ -614,7 +614,7 @@ create_bash(Camera *cam)
614614
static bool
615615
skill_trip(Skill *skill, SkillData *data)
616616
{
617-
UNUSED(skill);
617+
(void)skill;
618618

619619
Position playerPos, targetPos;
620620
if (!check_skill_validity(&playerPos, &targetPos, data)) {
@@ -688,7 +688,7 @@ create_trip(Camera *cam)
688688
static bool
689689
skill_backstab(Skill *skill, SkillData *data)
690690
{
691-
UNUSED(skill);
691+
(void)skill;
692692

693693
Position playerPos, targetPos;
694694
if (!check_skill_validity(&playerPos, &targetPos, data)) {
@@ -770,7 +770,7 @@ create_backstab(Camera *cam)
770770
static bool
771771
skill_phase(Skill *skill, SkillData *data)
772772
{
773-
UNUSED(skill);
773+
(void)skill;
774774
mixer_play_effect(FADE_OUT);
775775
data->player->phase_count = 3;
776776
return true;
@@ -805,7 +805,7 @@ skill_sip_health_available(Player *player)
805805
static bool
806806
skill_sip_health(Skill *skill, SkillData *data)
807807
{
808-
UNUSED(skill);
808+
(void)skill;
809809
player_sip_health(data->player);
810810
return true;
811811
}
@@ -870,7 +870,7 @@ skill_charge_check_path(SkillData *data, Position origin, Position dest)
870870
static bool
871871
skill_charge(Skill *skill, SkillData *data)
872872
{
873-
UNUSED(skill);
873+
(void)skill;
874874

875875
Player *player = data->player;
876876
RoomMatrix *matrix = data->matrix;
@@ -954,7 +954,7 @@ create_charge(void)
954954
static bool
955955
skill_blink(Skill *skill, SkillData *data)
956956
{
957-
UNUSED(skill);
957+
(void)skill;
958958

959959
Player *player = data->player;
960960
RoomMatrix *matrix = data->matrix;
@@ -1023,7 +1023,7 @@ create_blink(void)
10231023
static bool
10241024
skill_erupt(Skill *skill, SkillData *data)
10251025
{
1026-
UNUSED(skill);
1026+
(void)skill;
10271027

10281028
Player *player = data->player;
10291029
RoomMatrix *rm = data->matrix;

src/skillbar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ render_skills(Player *player, Camera *cam)
323323
static void
324324
render_artifacts(SkillBar *bar, Camera *cam)
325325
{
326-
UNUSED(bar);
326+
(void)bar;
327327
for (size_t i = 0; i < LAST_ARTIFACT_EFFECT; ++i) {
328328
if (bar->artifacts[i].lvl == 0)
329329
continue;

src/util.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void
3535
m_strcpy(char *dest, size_t destsz, const char *src)
3636
{
3737
#ifndef _MSC_VER
38-
UNUSED(destsz);
38+
(void)destsz;
3939
strncpy(dest, src, destsz);
4040
#else // _MSC_VER
4141
strcpy_s(dest, destsz, src);
@@ -46,8 +46,8 @@ void
4646
m_strncat(char *dest, size_t destsz, char *src, size_t srcsz)
4747
{
4848
#ifndef _MSC_VER
49-
UNUSED(destsz);
50-
UNUSED(srcsz);
49+
(void)destsz;
50+
(void)srcsz;
5151
strncat(dest, src, srcsz);
5252
#else // _MSC_VER
5353
strncat_s(dest, destsz, src, srcsz);
@@ -61,7 +61,7 @@ m_sprintf(char *dest, size_t destsz, const char *format, ...)
6161

6262
va_start(args, format);
6363
#ifndef _MSC_VER
64-
UNUSED(destsz);
64+
(void)destsz;
6565
vsnprintf(dest, destsz, format, args);
6666
#else // _MSC_VER
6767
vsprintf_s(dest, destsz, format, args);
@@ -73,7 +73,7 @@ void
7373
m_vsprintf(char *dest, size_t sz, const char *fmt, va_list args)
7474
{
7575
#ifndef _MSC_VER
76-
UNUSED(sz);
76+
(void)sz;
7777
vsnprintf(dest, sz, fmt, args);
7878
#else // _MSC_VER
7979
vsprintf_s(dest, sz, fmt, args);
@@ -108,10 +108,10 @@ log_print(FILE *out, const char *prefix, const char *file, int line, const char
108108
fprintf(out, "[%s][%5s][%20s:%-3d][%20s()] ", tstamp, prefix, file, line, function);
109109
#endif // _WIN32
110110
#else // DEBUG
111-
UNUSED(prefix);
112-
UNUSED(file);
113-
UNUSED(line);
114-
UNUSED(function);
111+
(void)prefix;
112+
(void)file;
113+
(void)line;
114+
(void)function;
115115
#endif // DEBUG
116116
va_start(args, fmt);
117117
vfprintf(out, fmt, args);

0 commit comments

Comments
 (0)