diff --git a/include/kernaux/stdlib.h b/include/kernaux/stdlib.h index b134a09..0453c4a 100644 --- a/include/kernaux/stdlib.h +++ b/include/kernaux/stdlib.h @@ -1,6 +1,8 @@ #ifndef KERNAUX_INCLUDED_STDLIB #define KERNAUX_INCLUDED_STDLIB 1 +#define KERNAUX_NULL ((void*)0) + #define KERNAUX_FALSE ((kernaux_bool)0) #define KERNAUX_TRUE ((kernaux_bool)1) diff --git a/src/multiboot2/helpers.c b/src/multiboot2/helpers.c index 4f4473a..562ec1e 100644 --- a/src/multiboot2/helpers.c +++ b/src/multiboot2/helpers.c @@ -9,7 +9,7 @@ const struct KernAux_Multiboot2_TagBase *KernAux_Multiboot2_first_tag_with_type( while ((void*)tag_base < (void*)multiboot2 + multiboot2->total_size) { if (!KernAux_Multiboot2_TagBase_is_valid(tag_base)) { - return 0; + return KERNAUX_NULL; } if (tag_base->type == tag_type) { @@ -21,7 +21,7 @@ const struct KernAux_Multiboot2_TagBase *KernAux_Multiboot2_first_tag_with_type( ); } - return 0; + return KERNAUX_NULL; } const struct KernAux_Multiboot2_TagBase *KernAux_Multiboot2_tag_with_type_after( @@ -34,7 +34,7 @@ const struct KernAux_Multiboot2_TagBase *KernAux_Multiboot2_tag_with_type_after( while ((void*)tag_base < (void*)multiboot2 + multiboot2->total_size) { if (!KernAux_Multiboot2_TagBase_is_valid(tag_base)) { - return 0; + return KERNAUX_NULL; } if (tag_base->type == tag_type && tag_base > after_tag) { @@ -46,7 +46,7 @@ const struct KernAux_Multiboot2_TagBase *KernAux_Multiboot2_tag_with_type_after( ); } - return 0; + return KERNAUX_NULL; } const char *KernAux_Multiboot2_boot_cmd_line( @@ -60,7 +60,7 @@ const char *KernAux_Multiboot2_boot_cmd_line( ); if (!tag) { - return 0; + return KERNAUX_NULL; } return tag->cmdline; diff --git a/src/multiboot2/is_valid.c b/src/multiboot2/is_valid.c index d6f14dd..e078576 100644 --- a/src/multiboot2/is_valid.c +++ b/src/multiboot2/is_valid.c @@ -10,7 +10,7 @@ kernaux_bool KernAux_Multiboot2_is_valid( const struct KernAux_Multiboot2_TagBase *tag_base = (struct KernAux_Multiboot2_TagBase*)multiboot2->data; - const struct KernAux_Multiboot2_TagBase *none_tag_base = (void*)0; + const struct KernAux_Multiboot2_TagBase *none_tag_base = KERNAUX_NULL; while ((void*)tag_base < (void*)multiboot2 + multiboot2->total_size) { if (!KernAux_Multiboot2_TagBase_is_valid(tag_base)) { @@ -18,7 +18,7 @@ kernaux_bool KernAux_Multiboot2_is_valid( } if (tag_base->type == KERNAUX_MULTIBOOT2_TAGTYPE_NONE && - none_tag_base == 0 + none_tag_base == KERNAUX_NULL ) { none_tag_base = tag_base; } diff --git a/src/multiboot2/print.c b/src/multiboot2/print.c index 5ac1309..986b33c 100644 --- a/src/multiboot2/print.c +++ b/src/multiboot2/print.c @@ -65,7 +65,7 @@ const char *KernAux_Multiboot2_TagType_to_str( case KERNAUX_MULTIBOOT2_TAGTYPE_IMAGE_LOAD_BASE_PHYS_ADDR: return "image load base phys addr"; default: - return 0; + return KERNAUX_NULL; } }