From 1c71abb6f6794437729f69da335f8f286412cf07 Mon Sep 17 00:00:00 2001 From: Dominik Loidolt <dominik.loidolt@univie.ac.at> Date: Thu, 29 Jun 2023 14:52:01 +0200 Subject: [PATCH] fix checkpatch suggestions --- lib/cmp_io.c | 10 +++++----- lib/cmp_max_used_bits.c | 2 +- lib/cmp_max_used_bits_list.c | 17 +++++++++-------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/lib/cmp_io.c b/lib/cmp_io.c index e3498c8..8f511e6 100644 --- a/lib/cmp_io.c +++ b/lib/cmp_io.c @@ -185,7 +185,7 @@ int write_input_data_to_file(void *data, uint32_t data_size, enum cmp_data_type memcpy(tmp_buf, data, data_size); cmp_input_big_to_cpu_endianness(tmp_buf, data_size, data_type); - return_value = write_data_to_file(tmp_buf, data_size, output_prefix, + return_value = write_data_to_file(tmp_buf, data_size, output_prefix, name_extension, flags); free(tmp_buf); @@ -241,7 +241,7 @@ int write_data_to_file(const void *buf, uint32_t buf_size, const char *output_pr /* convert data to ASCII */ output_file_size = buf_size*3 + 1; tmp_buf = malloc(output_file_size); - if (!tmp_buf){ + if (!tmp_buf) { fclose(fp); return -1; } @@ -1094,7 +1094,7 @@ int cmp_info_read(const char *file_name, struct cmp_info *info, int verbose_en) * @returns a pointer to the character after the spaces */ -static __inline const char *skip_space(const char *str) +static const char *skip_space(const char *str) { while (isspace(*str)) str++; @@ -1110,7 +1110,7 @@ static __inline const char *skip_space(const char *str) * @returns a pointer to the character after the comment */ -static __inline const char *skip_comment(const char *str) +static const char *skip_comment(const char *str) { char c = *str; @@ -1143,7 +1143,7 @@ static __inline const char *skip_comment(const char *str) * conversion can be performed, 0 is returned (errno is set to EINVAL)). */ -static __inline uint8_t str_to_uint8(const char *str, char const **str_end) +static uint8_t str_to_uint8(const char *str, char const **str_end) { const int BASE = 16; int i; diff --git a/lib/cmp_max_used_bits.c b/lib/cmp_max_used_bits.c index b37a1c2..3471e7e 100644 --- a/lib/cmp_max_used_bits.c +++ b/lib/cmp_max_used_bits.c @@ -65,7 +65,7 @@ #define MAX_USED_FC_BACKGROUND_OUTLIER_PIXELS_BITS 16 /* TBC */ -#define member_bit_size(type, member) sizeof(((type *)0)->member)*8 +#define member_bit_size(type, member) (sizeof(((type *)0)->member)*8) /* a safe the different data products types in bits */ diff --git a/lib/cmp_max_used_bits_list.c b/lib/cmp_max_used_bits_list.c index bc66d9e..28fe312 100644 --- a/lib/cmp_max_used_bits_list.c +++ b/lib/cmp_max_used_bits_list.c @@ -46,7 +46,8 @@ LIST_HEAD(max_used_bits_list); const struct cmp_max_used_bits *cmp_max_used_bits_list_get(uint8_t version) { - struct list_item *list_ptr = NULL ; + struct list_item *list_ptr = NULL; + switch (version) { case 0: return &MAX_USED_BITS_SAFE; @@ -55,7 +56,7 @@ const struct cmp_max_used_bits *cmp_max_used_bits_list_get(uint8_t version) } - list_for_each_entry (list_ptr, &max_used_bits_list, list) { + list_for_each_entry(list_ptr, &max_used_bits_list, list) { if (list_ptr->data.version == version) return &list_ptr->data; } @@ -110,10 +111,10 @@ int cmp_max_used_bits_list_add(struct cmp_max_used_bits const *item) void cmp_max_used_bits_list_delet(uint8_t version) { - struct list_item *list_ptr = NULL ; - struct list_item *tmp = NULL ; + struct list_item *list_ptr = NULL; + struct list_item *tmp = NULL; - list_for_each_entry_safe (list_ptr, tmp, &max_used_bits_list, list) { + list_for_each_entry_safe(list_ptr, tmp, &max_used_bits_list, list) { if (list_ptr->data.version == version) { list_del(&list_ptr->list); free(list_ptr); @@ -129,10 +130,10 @@ void cmp_max_used_bits_list_delet(uint8_t version) void cmp_max_used_bits_list_empty(void) { - struct list_item *list_ptr = NULL ; - struct list_item *tmp = NULL ; + struct list_item *list_ptr = NULL; + struct list_item *tmp = NULL; - list_for_each_entry_safe (list_ptr, tmp, &max_used_bits_list, list) { + list_for_each_entry_safe(list_ptr, tmp, &max_used_bits_list, list) { list_del(&list_ptr->list); free(list_ptr); list_ptr = NULL; -- GitLab