Skip to content

Commit ebffbe1

Browse files
committed
Move ARRAY_SIZE macro to util.h.
1 parent 58af974 commit ebffbe1

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

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

84-
#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
85-
8684
void vfs_user_build_filesystem()
8785
{
8886
uint32_t file_size;
@@ -294,7 +292,7 @@ static uint32_t read_file_assert_txt(uint32_t sector_offset, uint8_t *data, uint
294292
uint32_t * hexdumps = 0;
295293
uint8_t valid_hexdumps = 0;
296294
uint8_t index = 0;
297-
295+
298296
if (sector_offset != 0) {
299297
return 0;
300298
}
@@ -332,7 +330,7 @@ static uint32_t read_file_assert_txt(uint32_t sector_offset, uint8_t *data, uint
332330
pos += util_write_string(buf + pos, "\r\n");
333331
}
334332
}
335-
333+
336334
return pos;
337335
}
338336

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)