home
·
contact
·
privacy
projects
/
plomrogue
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3dedf63
)
Remove redundant uses of NULL.
author
Christian Heller
<c.heller@plomlompom.de>
Sun, 17 Aug 2014 02:26:47 +0000
(
04:26
+0200)
committer
Christian Heller
<c.heller@plomlompom.de>
Sun, 17 Aug 2014 02:26:47 +0000
(
04:26
+0200)
17 files changed:
src/client/command_db.c
patch
|
blob
|
history
src/client/interface_conf.c
patch
|
blob
|
history
src/client/io.c
patch
|
blob
|
history
src/client/parse.c
patch
|
blob
|
history
src/client/wincontrol.c
patch
|
blob
|
history
src/client/windows.c
patch
|
blob
|
history
src/common/readwrite.c
patch
|
blob
|
history
src/common/rexit.c
patch
|
blob
|
history
src/common/try_malloc.c
patch
|
blob
|
history
src/server/ai.c
patch
|
blob
|
history
src/server/field_of_view.c
patch
|
blob
|
history
src/server/god_commands.c
patch
|
blob
|
history
src/server/init.c
patch
|
blob
|
history
src/server/io.c
patch
|
blob
|
history
src/server/run.c
patch
|
blob
|
history
src/server/thing_actions.c
patch
|
blob
|
history
src/server/things.c
patch
|
blob
|
history
diff --git
a/src/client/command_db.c
b/src/client/command_db.c
index a7523b79a1a40b2863eac2dbc3dc45cf60fd3527..34ca8211e1e0a72304ff596f989cbbc4a8c45b54 100644
(file)
--- a/
src/client/command_db.c
+++ b/
src/client/command_db.c
@@
-64,7
+64,7
@@
static void tokens_into_entries(char * token0, char * token1)
cmd = (struct Command *) parse_init_entry(&cmd_flags,
sizeof(struct Command));
cmd->dsc_short = strdup(token1);
cmd = (struct Command *) parse_init_entry(&cmd_flags,
sizeof(struct Command));
cmd->dsc_short = strdup(token1);
- parse_id_uniq(
NULL != get_command(cmd->dsc_short
));
+ parse_id_uniq(
!(!get_command(cmd->dsc_short)
));
}
else if (!( parse_flagval(token0, token1, "DESCRIPTION", &cmd_flags,
DESC_SET, 's', (char *) &cmd->dsc_long)
}
else if (!( parse_flagval(token0, token1, "DESCRIPTION", &cmd_flags,
DESC_SET, 's', (char *) &cmd->dsc_long)
diff --git
a/src/client/interface_conf.c
b/src/client/interface_conf.c
index 9e97c55888d0202605d504e4d7118d83d083ef99..45abd6a8805cdf459dd534a656771f1559f89d51 100644
(file)
--- a/
src/client/interface_conf.c
+++ b/
src/client/interface_conf.c
@@
-243,7
+243,7
@@
static uint8_t start_win(char * token0, char * token1, char * str_win,
}
*win = (struct Win *) parse_init_entry(win_flags, sizeof(struct Win));
parsetest_singlechar(token1);
}
*win = (struct Win *) parse_init_entry(win_flags, sizeof(struct Win));
parsetest_singlechar(token1);
- parse_id_uniq(world.winDB.ids &&
(NULL!=strchr(world.winDB.ids,token1[0])
));
+ parse_id_uniq(world.winDB.ids &&
strchr(world.winDB.ids,token1[0]
));
(*win)->id = token1[0];
return 1;
}
(*win)->id = token1[0];
return 1;
}
@@
-367,7
+367,7
@@
static void set_keybindings(char * token1, uint8_t flags,
}
kb.keycode = atoi(token1);
char * err_uniq = "Binding to key already defined.";
}
kb.keycode = atoi(token1);
char * err_uniq = "Binding to key already defined.";
- err_line(
NULL != get_command_to_keycode(kbdb, kb.keycode
), err_uniq);
+ err_line(
!(!get_command_to_keycode(kbdb, kb.keycode)
), err_uniq);
kb.command = get_command(token2);
err_line(!(kb.command), "No such command in command DB.");
array_append(kbdb->n_of_kbs, sizeof(struct KeyBinding), (void *) &kb,
kb.command = get_command(token2);
err_line(!(kb.command), "No such command in command DB.");
array_append(kbdb->n_of_kbs, sizeof(struct KeyBinding), (void *) &kb,
diff --git
a/src/client/io.c
b/src/client/io.c
index c0cf977bf0d802ec24f9cb3207ab2154ebe59b0d..39fd75e657526cc7ea4a45f1a53eac330f1c9a91 100644
(file)
--- a/
src/client/io.c
+++ b/
src/client/io.c
@@
-98,7
+98,7
@@
static void read_inventory(char * read_buf, uint32_t linemax, FILE * file)
break;
}
int old_size = 0;
break;
}
int old_size = 0;
- if (
NULL !=
world.player_inventory)
+ if (world.player_inventory)
{
old_size = strlen(world.player_inventory);
}
{
old_size = strlen(world.player_inventory);
}
@@
-146,7
+146,7
@@
static void read_log(char * read_buf, uint32_t linemax, FILE * file)
while (try_fgets(read_buf, linemax + 1, file, __func__))
{
int old_size = 0;
while (try_fgets(read_buf, linemax + 1, file, __func__))
{
int old_size = 0;
- if (
NULL !=
world.log)
+ if (world.log)
{
old_size = strlen(world.log);
}
{
old_size = strlen(world.log);
}
diff --git
a/src/client/parse.c
b/src/client/parse.c
index 54d8fc3fb59d0027b3d7d17f8545a0a28ddf9594..c233a9203eb210d29a4fc608f7bbd854a07ccfbc 100644
(file)
--- a/
src/client/parse.c
+++ b/
src/client/parse.c
@@
-31,7
+31,7
@@
extern void parse_file(char * path, void (* token_to_entry) (char *, char *))
char * errline_line = try_malloc(linemax + 1, __func__);
set_err_line_options(errline_intro, errline_line, 1);
err_line_zero();
char * errline_line = try_malloc(linemax + 1, __func__);
set_err_line_options(errline_intro, errline_line, 1);
err_line_zero();
- err_line(
0 ==
linemax, "File is empty.");
+ err_line(
!
linemax, "File is empty.");
char * token0 = NULL; /* For final token_to_entry() if while() stagnates. */
char * token1 = NULL;
char * err_val = "No value given.";
char * token0 = NULL; /* For final token_to_entry() if while() stagnates. */
char * token1 = NULL;
char * err_val = "No value given.";
@@
-65,7
+65,7
@@
extern void parsetest_defcontext(uint8_t flags)
extern void parsetest_too_many_values()
{
extern void parsetest_too_many_values()
{
- err_line(
NULL != token_from_line(NULL
), "Too many values.");
+ err_line(
!(!token_from_line(NULL)
), "Too many values.");
}
}
diff --git
a/src/client/wincontrol.c
b/src/client/wincontrol.c
index 85750ec1f5005c9c1cc6ead76e808aa2fb7f6959..7dadbc8ed9dad49764a96ff0c9cd3e72d49d80f3 100644
(file)
--- a/
src/client/wincontrol.c
+++ b/
src/client/wincontrol.c
@@
-220,7
+220,7
@@
static void suspend_win(struct Win * w)
extern void toggle_window(char id)
{
struct Win * win = get_win_by_id(id);
extern void toggle_window(char id)
{
struct Win * win = get_win_by_id(id);
- if (
NULL ==
strchr(world.winDB.order, id))
+ if (
!
strchr(world.winDB.order, id))
{
append_win(win);
return;
{
append_win(win);
return;
diff --git
a/src/client/windows.c
b/src/client/windows.c
index 3881393ac01babe807f69e74576cf9c46f49d01f..14cf9b28ee478a27d9e563115ca832d0e7949029 100644
(file)
--- a/
src/client/windows.c
+++ b/
src/client/windows.c
@@
-400,7
+400,7
@@
extern void make_v_screen_and_init_win_sizes()
world.winDB.v_screen_size.y = maxy_test;
world.winDB.v_screen_size.x = maxx_test;
world.winDB.v_screen = newpad(world.winDB.v_screen_size.y, 1);
world.winDB.v_screen_size.y = maxy_test;
world.winDB.v_screen_size.x = maxx_test;
world.winDB.v_screen = newpad(world.winDB.v_screen_size.y, 1);
- exit_trouble(
NULL ==
world.winDB.v_screen, __func__, err_m);
+ exit_trouble(
!
world.winDB.v_screen, __func__, err_m);
char id;
while (0 != (id = get_next_win_id()))
{
char id;
while (0 != (id = get_next_win_id()))
{
diff --git
a/src/common/readwrite.c
b/src/common/readwrite.c
index ac7b56acad990ac6763d0022fd4e0c37cd99c34a..a206c9c2f2e7eb61ca215d1392ab015b580d7f3b 100644
(file)
--- a/
src/common/readwrite.c
+++ b/
src/common/readwrite.c
@@
-26,7
+26,7
@@
extern FILE * try_fopen(char * path, char * mode, const char * f)
int test = sprintf(msg, "%s%s%s%s%s%s%s", msg1,f,msg2,mode,msg3,path,msg4);
exit_trouble(test < 0, __func__, "sprintf");
FILE * file_p = fopen(path, mode);
int test = sprintf(msg, "%s%s%s%s%s%s%s", msg1,f,msg2,mode,msg3,path,msg4);
exit_trouble(test < 0, __func__, "sprintf");
FILE * file_p = fopen(path, mode);
- exit_err(
NULL ==
file_p, msg);
+ exit_err(
!
file_p, msg);
free(msg);
return file_p;
}
free(msg);
return file_p;
}
@@
-68,7
+68,7
@@
extern int try_fgetc(FILE * file, const char * f)
extern char * try_fgets(char * line, int linemax, FILE * file, const char * f)
{
char * test = fgets(line, linemax, file);
extern char * try_fgets(char * line, int linemax, FILE * file, const char * f)
{
char * test = fgets(line, linemax, file);
- exit_trouble(
NULL ==
test && ferror(file), f, "fgets");
+ exit_trouble(
!
test && ferror(file), f, "fgets");
return test;
}
return test;
}
diff --git
a/src/common/rexit.c
b/src/common/rexit.c
index a3e18b2664648dc13139c0943135291d37425ce7..b528975290ae7eaf78f9dcd6027b9be4afeefd4b 100644
(file)
--- a/
src/common/rexit.c
+++ b/
src/common/rexit.c
@@
-28,7
+28,7
@@
extern void exit_err(int err, const char * msg)
return;
}
cleanup_func();
return;
}
cleanup_func();
- if (
NULL ==
msg)
+ if (
!
msg)
{
msg = "Details unknown.";
}
{
msg = "Details unknown.";
}
diff --git
a/src/common/try_malloc.c
b/src/common/try_malloc.c
index 81e75bf6bda6aa3f0ed5a86205f1b1dc93be6a9d..41d80c9db1402a07bae04636346a82617e6e28e4 100644
(file)
--- a/
src/common/try_malloc.c
+++ b/
src/common/try_malloc.c
@@
-13,12
+13,12
@@
extern void * try_malloc(size_t size, const char * f)
{
char * prefix = "Trouble with malloc in ";
char * msg = malloc(strlen(prefix) + strlen(f) + 1 + 1);
{
char * prefix = "Trouble with malloc in ";
char * msg = malloc(strlen(prefix) + strlen(f) + 1 + 1);
- exit_err(
NULL ==
msg,
+ exit_err(
!
msg,
"Trouble in try_malloc with malloc for error message string.");
int test = sprintf(msg, "%s%s.", prefix, f);
exit_err(test < 0, "Trouble in try_malloc with sprintf.");
void * p = malloc(size);
"Trouble in try_malloc with malloc for error message string.");
int test = sprintf(msg, "%s%s.", prefix, f);
exit_err(test < 0, "Trouble in try_malloc with sprintf.");
void * p = malloc(size);
- exit_err(
NULL == p, msg);
/* Bypass exit_trouble() calling try_malloc(). */
+ exit_err(
!p, msg);
/* Bypass exit_trouble() calling try_malloc(). */
free(msg);
return p;
}
free(msg);
return p;
}
diff --git
a/src/server/ai.c
b/src/server/ai.c
index cdefca844bb78dc87277b409d25f2f12ce183137..630c2dbe20a9b342049c6d5470b0226484bb081c 100644
(file)
--- a/
src/server/ai.c
+++ b/
src/server/ai.c
@@
-1,7
+1,6
@@
/* src/server/ai.c */
#include "ai.h"
/* src/server/ai.c */
#include "ai.h"
-#include <stddef.h> /* NULL */
#include <stdint.h> /* uint8_t, uint16_t, uint32_t, int16_t, UINT16_MAX */
#include <stdlib.h> /* free() */
#include "../common/try_malloc.h" /* try_malloc() */
#include <stdint.h> /* uint8_t, uint16_t, uint32_t, int16_t, UINT16_MAX */
#include <stdlib.h> /* free() */
#include "../common/try_malloc.h" /* try_malloc() */
@@
-268,7
+267,7
@@
static int16_t get_inventory_slot_to_consume(struct Thing * t_owner)
int16_t selection = -1;
struct Thing * t = t_owner->owns;;
uint8_t i;
int16_t selection = -1;
struct Thing * t = t_owner->owns;;
uint8_t i;
- for (i = 0; t
!= NULL
; t = t->next, i++)
+ for (i = 0; t; t = t->next, i++)
{
struct ThingType * tt = get_thing_type(t->type);
if (tt->consumable > compare_consumability)
{
struct ThingType * tt = get_thing_type(t->type);
if (tt->consumable > compare_consumability)
@@
-285,7
+284,7
@@
static int16_t get_inventory_slot_to_consume(struct Thing * t_owner)
static uint8_t standing_on_consumable(struct Thing * t_standing)
{
struct Thing * t = world.things;
static uint8_t standing_on_consumable(struct Thing * t_standing)
{
struct Thing * t = world.things;
- for (; t
!= NULL
; t = t->next)
+ for (; t; t = t->next)
{
if ( t != t_standing
&& t->pos.y == t_standing->pos.y && t->pos.x == t_standing->pos.x)
{
if ( t != t_standing
&& t->pos.y == t_standing->pos.y && t->pos.x == t_standing->pos.x)
diff --git
a/src/server/field_of_view.c
b/src/server/field_of_view.c
index 4b1ac00194d6a9498b2e3a5a3a8bba818bb147cd..07e1455999a0f81de63ce97b667ed03fd6f6a6b6 100644
(file)
--- a/
src/server/field_of_view.c
+++ b/
src/server/field_of_view.c
@@
-374,7
+374,7
@@
static void update_map_memory(struct Thing * t_eye, uint32_t map_size)
struct ThingInMemory * tm = t_eye->t_mem;
struct ThingInMemory * tm_prev = NULL;
struct ThingInMemory * tm_next = NULL;
struct ThingInMemory * tm = t_eye->t_mem;
struct ThingInMemory * tm_prev = NULL;
struct ThingInMemory * tm_next = NULL;
- for (; tm
!= NULL
; tm = tm_next)
+ for (; tm; tm = tm_next)
{
tm_next = tm->next;
if ('v' == t_eye->fov_map[tm->pos.y * world.map.length + tm->pos.x])
{
tm_next = tm->next;
if ('v' == t_eye->fov_map[tm->pos.y * world.map.length + tm->pos.x])
@@
-393,7
+393,7
@@
static void update_map_memory(struct Thing * t_eye, uint32_t map_size)
tm_prev = tm;
}
struct Thing * t = world.things;
tm_prev = tm;
}
struct Thing * t = world.things;
- for (; t
!= NULL
; t = t->next)
+ for (; t; t = t->next)
{
if ( !t->lifepoints
&& 'v' == t_eye->fov_map[t->pos.y * world.map.length + t->pos.x])
{
if ( !t->lifepoints
&& 'v' == t_eye->fov_map[t->pos.y * world.map.length + t->pos.x])
diff --git
a/src/server/god_commands.c
b/src/server/god_commands.c
index 09aeecec624d60e48d0703478c0f46787d550968..420142a92d830eb5eaeb6ce13d25822d1b438466 100644
(file)
--- a/
src/server/god_commands.c
+++ b/
src/server/god_commands.c
@@
-301,7
+301,7
@@
static uint8_t parse_thing_manipulation_1arg(char * tok0, char * tok1)
{
t = get_thing(world.things, id, 1);
char * err = "No thing type found to initialize new thing.";
{
t = get_thing(world.things, id, 1);
char * err = "No thing type found to initialize new thing.";
- if (!t && !err_line(
NULL ==
world.thing_types, err))
+ if (!t && !err_line(
!
world.thing_types, err))
{
t = add_thing(id, world.thing_types->id, 0, 0);
if (world.exists && t->lifepoints)
{
t = add_thing(id, world.thing_types->id, 0, 0);
if (world.exists && t->lifepoints)
diff --git
a/src/server/init.c
b/src/server/init.c
index 49ba22a62732b0f5c818536cd77aac809420ace4..aa5761cfff0cb40dbb5857209740d765f4e613df 100644
(file)
--- a/
src/server/init.c
+++ b/
src/server/init.c
@@
-55,7
+55,7
@@
static void obey_lines_from_file(char * path, uint8_t record)
FILE * file = try_fopen(path, "r", __func__);
uint32_t linemax = textfile_width(file);
char * line = try_malloc(linemax + 1, __func__);
FILE * file = try_fopen(path, "r", __func__);
uint32_t linemax = textfile_width(file);
char * line = try_malloc(linemax + 1, __func__);
- while (
NULL !=
try_fgets(line, linemax + 1, file, __func__))
+ while (try_fgets(line, linemax + 1, file, __func__))
{
if (strlen(line))
{
{
if (strlen(line))
{
@@
-84,7
+84,7
@@
static void replay_game()
uint32_t linemax = textfile_width(file);
char * line = try_malloc(linemax + 1, __func__);
while ( world.turn < world.replay
uint32_t linemax = textfile_width(file);
char * line = try_malloc(linemax + 1, __func__);
while ( world.turn < world.replay
- &&
NULL !=
try_fgets(line, linemax + 1, file, __func__))
+ && try_fgets(line, linemax + 1, file, __func__))
{
obey_msg(line, 0, 1);
err_line_inc();
{
obey_msg(line, 0, 1);
err_line_inc();
@@
-112,7
+112,7
@@
static uint8_t world_cannot_be_made()
{
uint8_t player_will_be_generated = 0;
struct ThingType * tt;
{
uint8_t player_will_be_generated = 0;
struct ThingType * tt;
- for (tt = world.thing_types;
NULL !=
tt; tt = tt->next)
+ for (tt = world.thing_types; tt; tt = tt->next)
{
if (world.player_type == tt->id)
{
{
if (world.player_type == tt->id)
{
@@
-197,7
+197,7
@@
extern uint8_t remake_world()
free_things(world.things);
remake_map();
struct ThingType * tt;
free_things(world.things);
remake_map();
struct ThingType * tt;
- for (tt = world.thing_types;
NULL !=
tt; tt = tt->next)
+ for (tt = world.thing_types; tt; tt = tt->next)
{
if (world.player_type == tt->id)
{
{
if (world.player_type == tt->id)
{
@@
-205,7
+205,7
@@
extern uint8_t remake_world()
break;
}
}
break;
}
}
- for (tt = world.thing_types;
NULL !=
tt; tt = tt->next)
+ for (tt = world.thing_types; tt; tt = tt->next)
{
if (world.player_type != tt->id)
{
{
if (world.player_type != tt->id)
{
@@
-213,7
+213,7
@@
extern uint8_t remake_world()
}
}
struct Thing * t;
}
}
struct Thing * t;
- for (t = world.things;
NULL !=
t; t = t->next)
+ for (t = world.things; t; t = t->next)
{
if (t->lifepoints)
{
{
if (t->lifepoints)
{
diff --git
a/src/server/io.c
b/src/server/io.c
index 8f8f738b46533dcbf099e08948f7524dc650e163..d8190c6038ec0f8588e688d988074af5dbc0853f 100644
(file)
--- a/
src/server/io.c
+++ b/
src/server/io.c
@@
-289,7
+289,7
@@
static void write_value_as_line(uint32_t value, FILE * file)
static void write_inventory(struct Thing * player, FILE * file)
{
struct Thing * owned = player->owns;
static void write_inventory(struct Thing * player, FILE * file)
{
struct Thing * owned = player->owns;
- if (
NULL ==
owned)
+ if (
!
owned)
{
char * empty = "(none)\n";
try_fwrite(empty, strlen(empty), 1, file, __func__);
{
char * empty = "(none)\n";
try_fwrite(empty, strlen(empty), 1, file, __func__);
@@
-297,7
+297,7
@@
static void write_inventory(struct Thing * player, FILE * file)
else
{
uint8_t q;
else
{
uint8_t q;
- for (q = 0;
NULL !=
owned; q++)
+ for (q = 0; owned; q++)
{
struct ThingType * tt = get_thing_type(owned->type);
try_fwrite(tt->name, strlen(tt->name), 1, file, __func__);
{
struct ThingType * tt = get_thing_type(owned->type);
try_fwrite(tt->name, strlen(tt->name), 1, file, __func__);
@@
-372,7
+372,7
@@
static void write_map(struct Thing * player, FILE * file)
struct ThingInMemory * tm;
for (i = 0; i < 2; i++)
{
struct ThingInMemory * tm;
for (i = 0; i < 2; i++)
{
- for (tm = player->t_mem; tm
!= NULL
; tm = tm->next)
+ for (tm = player->t_mem; tm; tm = tm->next)
{
if (' ' != player->mem_map[tm->pos.y*world.map.length+tm->pos.x])
{
{
if (' ' != player->mem_map[tm->pos.y*world.map.length+tm->pos.x])
{
diff --git
a/src/server/run.c
b/src/server/run.c
index 906bed266ae54f76edf06d5659a1f87d0fc24ce4..786b280adb050a64b47edc19e1cecdad46ad55bb 100644
(file)
--- a/
src/server/run.c
+++ b/
src/server/run.c
@@
-208,7
+208,7
@@
static void turn_over()
while ( 0 < player->lifepoints
|| (0 == player->lifepoints && start_turn == world.turn))
{
while ( 0 < player->lifepoints
|| (0 == player->lifepoints && start_turn == world.turn))
{
- if (
NULL ==
thing)
+ if (
!
thing)
{
world.turn++;
thing = world.things;
{
world.turn++;
thing = world.things;
@@
-285,7
+285,7
@@
extern void obey_msg(char * msg, uint8_t do_record, uint8_t do_verbose)
set_err_line_options("Trouble with message: ", msg, 0);
char * msg_copy = strdup(msg);
char * tok0 = token_from_line(msg_copy);
set_err_line_options("Trouble with message: ", msg, 0);
char * msg_copy = strdup(msg);
char * tok0 = token_from_line(msg_copy);
- if (
NULL !=
tok0)
+ if (tok0)
{
if (parse_command(tok0))
{
if (parse_command(tok0))
@@
-299,7
+299,7
@@
extern void obey_msg(char * msg, uint8_t do_record, uint8_t do_verbose)
record(msg, 0);
}
char * tokplus = token_from_line(NULL);
record(msg, 0);
}
char * tokplus = token_from_line(NULL);
- err_line(
NULL != tokplus
, "Too many arguments, ignoring overflow.");
+ err_line(
!(!tokplus)
, "Too many arguments, ignoring overflow.");
free(msg_copy);
return;
}
free(msg_copy);
return;
}
@@
-316,7
+316,7
@@
extern uint8_t io_loop()
{
char * msg = io_round();
server_test();
{
char * msg = io_round();
server_test();
- if (
NULL ==
msg)
+ if (
!
msg)
{
continue;
}
{
continue;
}
diff --git
a/src/server/thing_actions.c
b/src/server/thing_actions.c
index 40a44ba17ce71dd4ed51a8ae29137b9618edce95..ec713ae5bd02dc2e9dac915c48066e154812b151 100644
(file)
--- a/
src/server/thing_actions.c
+++ b/
src/server/thing_actions.c
@@
-286,7
+286,7
@@
extern void actor_move(struct Thing * t)
extern void actor_drop(struct Thing * t)
{
extern void actor_drop(struct Thing * t)
{
- uint8_t owns_none = (
NULL ==
t->owns);
+ uint8_t owns_none = (
!
t->owns);
if (!owns_none)
{
uint8_t select = t->arg;
if (!owns_none)
{
uint8_t select = t->arg;
@@
-307,21
+307,21
@@
extern void actor_pick(struct Thing * t)
{
struct Thing * picked = NULL;
struct Thing * t_i;
{
struct Thing * picked = NULL;
struct Thing * t_i;
- for (t_i = world.things;
NULL !=
t_i; t_i = t_i->next)
+ for (t_i = world.things; t_i; t_i = t_i->next)
{
if (t_i != t && yx_uint8_cmp(&t_i->pos, &t->pos))
{
picked = t_i;
}
}
{
if (t_i != t && yx_uint8_cmp(&t_i->pos, &t->pos))
{
picked = t_i;
}
}
- if (
NULL !=
picked)
+ if (picked)
{
own_thing(&t->owns, &world.things, picked->id);
set_thing_position(picked, t->pos);
}
if (t == get_player())
{
{
own_thing(&t->owns, &world.things, picked->id);
set_thing_position(picked, t->pos);
}
if (t == get_player())
{
- playerbonus_pick(
NULL != picked
);
+ playerbonus_pick(
!(!picked)
);
}
}
}
}
@@
-330,7
+330,7
@@
extern void actor_pick(struct Thing * t)
extern void actor_use(struct Thing * t)
{
uint8_t wrong_thing = 1;
extern void actor_use(struct Thing * t)
{
uint8_t wrong_thing = 1;
- uint8_t no_thing = (
NULL ==
t->owns);
+ uint8_t no_thing = (
!
t->owns);
if (!no_thing)
{
uint8_t select = t->arg;
if (!no_thing)
{
uint8_t select = t->arg;
diff --git
a/src/server/things.c
b/src/server/things.c
index 7d0f62d9b19be98ab2da6d1a145887b529aa04a2..bbe9dbffe39388399b741965c7ead8bb2aa61baa 100644
(file)
--- a/
src/server/things.c
+++ b/
src/server/things.c
@@
-45,7
+45,7
@@
static struct NextAndId * add_to_struct_list(size_t n_size, uint8_t start_id,
static void free_things_in_memory(struct ThingInMemory * tm)
{
static void free_things_in_memory(struct ThingInMemory * tm)
{
- if (
NULL ==
tm)
+ if (
!
tm)
{
return;
}
{
return;
}
@@
-82,7
+82,7
@@
static struct NextAndId * add_to_struct_list(size_t n_size, uint8_t start_id,
}
}
struct NextAndId ** nai_ptr_ptr = start;
}
}
struct NextAndId ** nai_ptr_ptr = start;
- for (;
NULL !=
* nai_ptr_ptr; nai_ptr_ptr = &(*nai_ptr_ptr)->next);
+ for (; * nai_ptr_ptr; nai_ptr_ptr = &(*nai_ptr_ptr)->next);
*nai_ptr_ptr = nai;
return nai;
}
*nai_ptr_ptr = nai;
return nai;
}
@@
-151,7
+151,7
@@
extern void add_thing_to_memory_map(struct Thing * t, uint8_t type,
extern void free_thing_actions(struct ThingAction * ta)
{
extern void free_thing_actions(struct ThingAction * ta)
{
- if (
NULL ==
ta)
+ if (
!
ta)
{
return;
}
{
return;
}
@@
-164,7
+164,7
@@
extern void free_thing_actions(struct ThingAction * ta)
extern void free_thing_types(struct ThingType * tt)
{
extern void free_thing_types(struct ThingType * tt)
{
- if (
NULL ==
tt)
+ if (
!
tt)
{
return;
}
{
return;
}
@@
-177,7
+177,7
@@
extern void free_thing_types(struct ThingType * tt)
extern void free_things(struct Thing * t)
{
extern void free_things(struct Thing * t)
{
- if (
NULL ==
t)
+ if (
!
t)
{
return;
}
{
return;
}
@@
-198,7
+198,7
@@
extern void free_things(struct Thing * t)
extern struct ThingAction * get_thing_action(uint8_t id)
{
struct ThingAction * ta = world.thing_actions;
extern struct ThingAction * get_thing_action(uint8_t id)
{
struct ThingAction * ta = world.thing_actions;
- for (;
NULL !=
ta && id != ta->id; ta = ta->next);
+ for (; ta && id != ta->id; ta = ta->next);
return ta;
}
return ta;
}
@@
-207,7
+207,7
@@
extern struct ThingAction * get_thing_action(uint8_t id)
extern struct ThingType * get_thing_type(uint8_t id)
{
struct ThingType * tt = world.thing_types;
extern struct ThingType * get_thing_type(uint8_t id)
{
struct ThingType * tt = world.thing_types;
- for (;
NULL !=
tt && id != tt->id; tt = tt->next);
+ for (; tt && id != tt->id; tt = tt->next);
return tt;
}
return tt;
}
@@
-216,7
+216,7
@@
extern struct ThingType * get_thing_type(uint8_t id)
extern uint8_t get_thing_action_id_by_name(char * name)
{
struct ThingAction * ta = world.thing_actions;
extern uint8_t get_thing_action_id_by_name(char * name)
{
struct ThingAction * ta = world.thing_actions;
- while (
NULL !=
ta)
+ while (ta)
{
if (0 == strcmp(ta->name, name))
{
{
if (0 == strcmp(ta->name, name))
{
@@
-237,14
+237,14
@@
extern struct Thing * get_thing(struct Thing * ptr, uint8_t id, uint8_t deep)
{
while (1)
{
{
while (1)
{
- if (
NULL ==
ptr || id == ptr->id)
+ if (
!
ptr || id == ptr->id)
{
return ptr;
}
if (deep)
{
struct Thing * owned_thing = get_thing(ptr->owns, id, 1);
{
return ptr;
}
if (deep)
{
struct Thing * owned_thing = get_thing(ptr->owns, id, 1);
- if (
NULL !=
owned_thing)
+ if (owned_thing)
{
return ptr;
}
{
return ptr;
}
@@
-324,7
+324,7
@@
extern void own_thing(struct Thing ** target, struct Thing ** source,
penult->next = t->next;
}
struct Thing ** t_ptr_ptr = target;
penult->next = t->next;
}
struct Thing ** t_ptr_ptr = target;
- for (;
NULL !=
* t_ptr_ptr; t_ptr_ptr = &(*t_ptr_ptr)->next);
+ for (; * t_ptr_ptr; t_ptr_ptr = &(*t_ptr_ptr)->next);
* t_ptr_ptr = t;
t->next = NULL;
}
* t_ptr_ptr = t;
t->next = NULL;
}
@@
-335,5
+335,5
@@
extern void set_thing_position(struct Thing * t, struct yx_uint8 pos)
{
t->pos = pos;
struct Thing * owned = t->owns;
{
t->pos = pos;
struct Thing * owned = t->owns;
- for (; owned
!= NULL
; set_thing_position(owned, pos), owned = owned->next);
+ for (; owned; set_thing_position(owned, pos), owned = owned->next);
}
}