1
0
Fork 0
mirror of https://github.com/tailix/libkernaux.git synced 2024-11-13 11:04:27 -05:00

Add const "KERNAUX_NULL"

This commit is contained in:
Alex Kotov 2020-11-30 05:15:36 +05:00
parent 3be57b6ccb
commit 6528cd1007
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
4 changed files with 10 additions and 8 deletions

View file

@ -1,6 +1,8 @@
#ifndef KERNAUX_INCLUDED_STDLIB #ifndef KERNAUX_INCLUDED_STDLIB
#define KERNAUX_INCLUDED_STDLIB 1 #define KERNAUX_INCLUDED_STDLIB 1
#define KERNAUX_NULL ((void*)0)
#define KERNAUX_FALSE ((kernaux_bool)0) #define KERNAUX_FALSE ((kernaux_bool)0)
#define KERNAUX_TRUE ((kernaux_bool)1) #define KERNAUX_TRUE ((kernaux_bool)1)

View file

@ -9,7 +9,7 @@ const struct KernAux_Multiboot2_TagBase *KernAux_Multiboot2_first_tag_with_type(
while ((void*)tag_base < (void*)multiboot2 + multiboot2->total_size) { while ((void*)tag_base < (void*)multiboot2 + multiboot2->total_size) {
if (!KernAux_Multiboot2_TagBase_is_valid(tag_base)) { if (!KernAux_Multiboot2_TagBase_is_valid(tag_base)) {
return 0; return KERNAUX_NULL;
} }
if (tag_base->type == tag_type) { 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( 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) { while ((void*)tag_base < (void*)multiboot2 + multiboot2->total_size) {
if (!KernAux_Multiboot2_TagBase_is_valid(tag_base)) { if (!KernAux_Multiboot2_TagBase_is_valid(tag_base)) {
return 0; return KERNAUX_NULL;
} }
if (tag_base->type == tag_type && tag_base > after_tag) { 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( const char *KernAux_Multiboot2_boot_cmd_line(
@ -60,7 +60,7 @@ const char *KernAux_Multiboot2_boot_cmd_line(
); );
if (!tag) { if (!tag) {
return 0; return KERNAUX_NULL;
} }
return tag->cmdline; return tag->cmdline;

View file

@ -10,7 +10,7 @@ kernaux_bool KernAux_Multiboot2_is_valid(
const struct KernAux_Multiboot2_TagBase *tag_base = const struct KernAux_Multiboot2_TagBase *tag_base =
(struct KernAux_Multiboot2_TagBase*)multiboot2->data; (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) { while ((void*)tag_base < (void*)multiboot2 + multiboot2->total_size) {
if (!KernAux_Multiboot2_TagBase_is_valid(tag_base)) { 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 && if (tag_base->type == KERNAUX_MULTIBOOT2_TAGTYPE_NONE &&
none_tag_base == 0 none_tag_base == KERNAUX_NULL
) { ) {
none_tag_base = tag_base; none_tag_base = tag_base;
} }

View file

@ -65,7 +65,7 @@ const char *KernAux_Multiboot2_TagType_to_str(
case KERNAUX_MULTIBOOT2_TAGTYPE_IMAGE_LOAD_BASE_PHYS_ADDR: case KERNAUX_MULTIBOOT2_TAGTYPE_IMAGE_LOAD_BASE_PHYS_ADDR:
return "image load base phys addr"; return "image load base phys addr";
default: default:
return 0; return KERNAUX_NULL;
} }
} }