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
#define KERNAUX_INCLUDED_STDLIB 1
#define KERNAUX_NULL ((void*)0)
#define KERNAUX_FALSE ((kernaux_bool)0)
#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) {
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;

View File

@ -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;
}

View File

@ -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;
}
}