diff --git a/include/kernaux/multiboot2.h b/include/kernaux/multiboot2.h index b3424b8..cf3e1d8 100644 --- a/include/kernaux/multiboot2.h +++ b/include/kernaux/multiboot2.h @@ -12,6 +12,10 @@ extern "C" { #define KERNAUX_MULTIBOOT2_DATA(ptr) (((uint8_t*)(ptr)) + sizeof(*(ptr))) +#define KERNAUX_MULTIBOOT2_HTAG_NEXT(tag_base) \ + ((struct KernAux_Multiboot2_HTagBase*)KERNAUX_MULTIBOOT2_TAG_NEXT(tag_base)) +#define KERNAUX_MULTIBOOT2_ITAG_NEXT(tag_base) \ + ((struct KernAux_Multiboot2_ITagBase*)KERNAUX_MULTIBOOT2_TAG_NEXT(tag_base)) #define KERNAUX_MULTIBOOT2_TAG_NEXT(tag_base) \ ((uint8_t*)tag_base + KERNAUX_MULTIBOOT2_TAG_SIZE_ALIGN(tag_base)) #define KERNAUX_MULTIBOOT2_TAG_SIZE_ALIGN(tag_base) \ diff --git a/src/multiboot2/header_helpers.c b/src/multiboot2/header_helpers.c index c077fcf..fb5d70e 100644 --- a/src/multiboot2/header_helpers.c +++ b/src/multiboot2/header_helpers.c @@ -24,9 +24,7 @@ const struct KernAux_Multiboot2_HTagBase // if (!KernAux_Multiboot2_HTagBase_is_valid(tag_base)) return NULL; if (tag_base->type == tag_type) return tag_base; - tag_base = (struct KernAux_Multiboot2_HTagBase*)( - KERNAUX_MULTIBOOT2_TAG_NEXT(tag_base) - ); + tag_base = KERNAUX_MULTIBOOT2_HTAG_NEXT(tag_base); } return NULL; @@ -50,9 +48,7 @@ const struct KernAux_Multiboot2_HTagBase // if (!KernAux_Multiboot2_HTagBase_is_valid(tag_base)) return NULL; if (tag_base->type == tag_type && tag_base > after_tag) return tag_base; - tag_base = (struct KernAux_Multiboot2_HTagBase*)( - KERNAUX_MULTIBOOT2_TAG_NEXT(tag_base) - ); + tag_base = KERNAUX_MULTIBOOT2_HTAG_NEXT(tag_base); } return NULL; diff --git a/src/multiboot2/info_helpers.c b/src/multiboot2/info_helpers.c index 767216c..2531a5f 100644 --- a/src/multiboot2/info_helpers.c +++ b/src/multiboot2/info_helpers.c @@ -23,9 +23,7 @@ const struct KernAux_Multiboot2_ITagBase if (!KernAux_Multiboot2_ITagBase_is_valid(tag_base)) return NULL; if (tag_base->type == tag_type) return tag_base; - tag_base = (struct KernAux_Multiboot2_ITagBase*)( - KERNAUX_MULTIBOOT2_TAG_NEXT(tag_base) - ); + tag_base = KERNAUX_MULTIBOOT2_ITAG_NEXT(tag_base); } return NULL; @@ -48,9 +46,7 @@ const struct KernAux_Multiboot2_ITagBase if (!KernAux_Multiboot2_ITagBase_is_valid(tag_base)) return NULL; if (tag_base->type == tag_type && tag_base > after_tag) return tag_base; - tag_base = (struct KernAux_Multiboot2_ITagBase*)( - KERNAUX_MULTIBOOT2_TAG_NEXT(tag_base) - ); + tag_base = KERNAUX_MULTIBOOT2_ITAG_NEXT(tag_base); } return NULL; diff --git a/src/multiboot2/info_is_valid.c b/src/multiboot2/info_is_valid.c index 459f3d2..b73c39c 100644 --- a/src/multiboot2/info_is_valid.c +++ b/src/multiboot2/info_is_valid.c @@ -29,9 +29,7 @@ bool KernAux_Multiboot2_Info_is_valid( none_tag_base = tag_base; } - tag_base = (struct KernAux_Multiboot2_ITagBase*)( - KERNAUX_MULTIBOOT2_TAG_NEXT(tag_base) - ); + tag_base = KERNAUX_MULTIBOOT2_ITAG_NEXT(tag_base); } if (tag_base != diff --git a/src/multiboot2/info_print.c b/src/multiboot2/info_print.c index 03c4211..6dda151 100644 --- a/src/multiboot2/info_print.c +++ b/src/multiboot2/info_print.c @@ -93,9 +93,7 @@ void KernAux_Multiboot2_Info_print( KernAux_Multiboot2_ITagBase_print(tag_base, printf); - tag_base = (struct KernAux_Multiboot2_ITagBase*)( - KERNAUX_MULTIBOOT2_TAG_NEXT(tag_base) - ); + tag_base = KERNAUX_MULTIBOOT2_ITAG_NEXT(tag_base); } }