Skip to content

Commit 4ea6d61

Browse files
committed
Move ARRAY_SIZE macro to util.h.
1 parent 72a46eb commit 4ea6d61

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

source/daplink/drag-n-drop/vfs_user.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,6 @@ static void erase_target(void);
126126

127127
static uint32_t expand_info(uint8_t *buf, uint32_t bufsize);
128128

129-
#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
130-
131129
void vfs_user_build_filesystem()
132130
{
133131
uint32_t file_size;
@@ -387,7 +385,7 @@ static uint32_t read_file_assert_txt(uint32_t sector_offset, uint8_t *data, uint
387385
uint32_t * hexdumps = 0;
388386
uint8_t valid_hexdumps = 0;
389387
uint8_t index = 0;
390-
388+
391389
if (sector_offset != 0) {
392390
return 0;
393391
}
@@ -425,7 +423,7 @@ static uint32_t read_file_assert_txt(uint32_t sector_offset, uint8_t *data, uint
425423
pos += util_write_string(buf + pos, "\r\n");
426424
}
427425
}
428-
426+
429427
return pos;
430428
}
431429

source/daplink/util.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
#include "stdbool.h"
2626
#include "stdint.h"
2727

28+
//! @brief Get number of elements in the array.
29+
#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
30+
2831
#ifdef __cplusplus
2932
extern "C" {
3033
#endif

0 commit comments

Comments
 (0)