Skip to content

Commit eecee51

Browse files
committed
Move ARRAY_SIZE macro to util.h.
1 parent ef4e1fa commit eecee51

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
@@ -80,8 +80,6 @@ static void erase_target(void);
8080

8181
static uint32_t expand_info(uint8_t *buf, uint32_t bufsize);
8282

83-
#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
84-
8583
void vfs_user_build_filesystem()
8684
{
8785
uint32_t file_size;
@@ -293,7 +291,7 @@ static uint32_t read_file_assert_txt(uint32_t sector_offset, uint8_t *data, uint
293291
uint32_t * hexdumps = 0;
294292
uint8_t valid_hexdumps = 0;
295293
uint8_t index = 0;
296-
294+
297295
if (sector_offset != 0) {
298296
return 0;
299297
}
@@ -331,7 +329,7 @@ static uint32_t read_file_assert_txt(uint32_t sector_offset, uint8_t *data, uint
331329
pos += util_write_string(buf + pos, "\r\n");
332330
}
333331
}
334-
332+
335333
return pos;
336334
}
337335

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)