portability: Avoid void* arithmetics which is a GNU extension
Under GNU C, sizeof(void) = 1. This commit merely makes it explicit u8. Pointer arithmetics over void types is: * A GNU C extension * Not supported by Clang * Illegal across all ISO C standards See also: https://gcc.gnu.org/onlinedocs/gcc/Pointer-Arith.html Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
This commit is contained in:
parent
a82cb2442d
commit
d67096da05
23 changed files with 62 additions and 55 deletions
|
@ -148,7 +148,7 @@ static inline const struct log_backend *log_backend_get(u32_t idx)
|
|||
*/
|
||||
static inline int log_backend_count_get(void)
|
||||
{
|
||||
return ((void *)__log_backends_end - (void *)__log_backends_start) /
|
||||
return ((u8_t *)__log_backends_end - (u8_t *)__log_backends_start) /
|
||||
sizeof(struct log_backend);
|
||||
}
|
||||
|
||||
|
|
|
@ -336,7 +336,7 @@ static inline u8_t log_compiled_level_get(u32_t source_id)
|
|||
static inline u32_t log_const_source_id(
|
||||
const struct log_source_const_data *data)
|
||||
{
|
||||
return ((char *)data - (char *)__log_const_start)/
|
||||
return ((u8_t *)data - (u8_t *)__log_const_start)/
|
||||
sizeof(struct log_source_const_data);
|
||||
}
|
||||
|
||||
|
@ -378,7 +378,7 @@ static inline u32_t *log_dynamic_filters_get(u32_t source_id)
|
|||
*/
|
||||
static inline u32_t log_dynamic_source_id(struct log_source_dynamic_data *data)
|
||||
{
|
||||
return ((char *)data - (char *)__log_dynamic_start)/
|
||||
return ((u8_t *)data - (u8_t *)__log_dynamic_start)/
|
||||
sizeof(struct log_source_dynamic_data);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue