Code nits - get rid of '== NULL' / '!= NULL'

This commit is contained in:
twinaphex 2014-12-10 16:40:43 +01:00
parent 7a0b0cba45
commit 512f7f5b27
4 changed files with 11 additions and 11 deletions

View File

@ -740,7 +740,7 @@ execute_ewram_ptr:
@ u32 gamepak_index = address >> 15; @ u32 gamepak_index = address >> 15;
@ u8 *map = memory_map_read[gamepak_index]; @ u8 *map = memory_map_read[gamepak_index];
@ if(map == NULL) @ if(!map)
@ map = load_gamepak_page(gamepak_index & 0x3FF); @ map = load_gamepak_page(gamepak_index & 0x3FF);
@ value = address##type(map, address & 0x7FFF) @ value = address##type(map, address & 0x7FFF)

View File

@ -80,7 +80,7 @@ static int manual_insmod_26(const char *fname, const char *opts)
FILE *f; FILE *f;
f = fopen(fname, "rb"); f = fopen(fname, "rb");
if (f == NULL) if (!f)
return -1; return -1;
fseek(f, 0, SEEK_END); fseek(f, 0, SEEK_END);
@ -88,7 +88,7 @@ static int manual_insmod_26(const char *fname, const char *opts)
fseek(f, 0, SEEK_SET); fseek(f, 0, SEEK_SET);
buff = malloc(len); buff = malloc(len);
if (buff == NULL) if (!buff)
goto fail0; goto fail0;
read_len = fread(buff, 1, len, f); read_len = fread(buff, 1, len, f);

4
cpu.c
View File

@ -689,7 +689,7 @@ void print_register_usage(void)
pc_region = new_pc_region; \ pc_region = new_pc_region; \
pc_address_block = memory_map_read[new_pc_region]; \ pc_address_block = memory_map_read[new_pc_region]; \
\ \
if(pc_address_block == NULL) \ if(!pc_address_block) \
pc_address_block = load_gamepak_page(pc_region & 0x3FF); \ pc_address_block = load_gamepak_page(pc_region & 0x3FF); \
} \ } \
@ -4069,7 +4069,7 @@ void execute_arm(u32 cycles)
u32 old_pc; u32 old_pc;
if(pc_address_block == NULL) if(!pc_address_block)
pc_address_block = load_gamepak_page(pc_region & 0x3FF); pc_address_block = load_gamepak_page(pc_region & 0x3FF);
while(1) while(1)

View File

@ -216,7 +216,7 @@ extern u8 bit_count[256];
pc_region = new_pc_region; \ pc_region = new_pc_region; \
pc_address_block = memory_map_read[new_pc_region]; \ pc_address_block = memory_map_read[new_pc_region]; \
\ \
if(pc_address_block == NULL) \ if(!pc_address_block) \
pc_address_block = load_gamepak_page(pc_region & 0x3FF); \ pc_address_block = load_gamepak_page(pc_region & 0x3FF); \
} \ } \
@ -2798,7 +2798,7 @@ u8 function_cc *block_lookup_address_##type(u32 pc) \
block_ptr = (u32 *)block_ptr[1]; \ block_ptr = (u32 *)block_ptr[1]; \
} \ } \
\ \
if(block_ptr == NULL) \ if(!block_ptr) \
{ \ { \
__label__ redo; \ __label__ redo; \
s32 translation_result; \ s32 translation_result; \
@ -3208,7 +3208,7 @@ s32 translate_block_arm(u32 pc, translation_region_type
generate_block_extra_vars_arm(); generate_block_extra_vars_arm();
arm_fix_pc(); arm_fix_pc();
if(pc_address_block == NULL) if(!pc_address_block)
pc_address_block = load_gamepak_page(pc_region & 0x3FF); pc_address_block = load_gamepak_page(pc_region & 0x3FF);
switch(translation_region) switch(translation_region)
@ -3389,7 +3389,7 @@ s32 translate_block_arm(u32 pc, translation_region_type
{ {
branch_target = external_block_exits[i].branch_target; branch_target = external_block_exits[i].branch_target;
arm_link_block(); arm_link_block();
if(translation_target == NULL) if(!translation_target)
return -1; return -1;
generate_branch_patch_unconditional( generate_branch_patch_unconditional(
external_block_exits[i].branch_source, translation_target); external_block_exits[i].branch_source, translation_target);
@ -3425,7 +3425,7 @@ s32 translate_block_thumb(u32 pc, translation_region_type
generate_block_extra_vars_thumb(); generate_block_extra_vars_thumb();
thumb_fix_pc(); thumb_fix_pc();
if(pc_address_block == NULL) if(!pc_address_block)
pc_address_block = load_gamepak_page(pc_region & 0x3FF); pc_address_block = load_gamepak_page(pc_region & 0x3FF);
switch(translation_region) switch(translation_region)
@ -3606,7 +3606,7 @@ s32 translate_block_thumb(u32 pc, translation_region_type
{ {
branch_target = external_block_exits[i].branch_target; branch_target = external_block_exits[i].branch_target;
thumb_link_block(); thumb_link_block();
if(translation_target == NULL) if(!translation_target)
return -1; return -1;
generate_branch_patch_unconditional( generate_branch_patch_unconditional(
external_block_exits[i].branch_source, translation_target); external_block_exits[i].branch_source, translation_target);