Implement storedevs, prepare to port littlefs
This commit is contained in:
@ -6,4 +6,34 @@
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#define LEN(X) (sizeof(X)/sizeof(X[0]))
|
||||
|
||||
#define LL_APPEND(head, new) \
|
||||
do { \
|
||||
if ((head) != NULL) { \
|
||||
typeof((head)) __tmp; \
|
||||
(new)->next = NULL; \
|
||||
__tmp = (head); \
|
||||
while (__tmp->next != NULL) { \
|
||||
__tmp = __tmp->next; \
|
||||
} \
|
||||
__tmp->next = (new); \
|
||||
} else { \
|
||||
(head) = (new); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define LL_REMOVE(head, ele) \
|
||||
do { \
|
||||
typeof((head)) __cur = (head); \
|
||||
typeof((head)) __prev = NULL; \
|
||||
while (__cur != (ele)) { \
|
||||
__prev = __cur; \
|
||||
__cur = __cur->next; \
|
||||
} \
|
||||
if (__prev != NULL) { \
|
||||
__prev->next = __cur->next; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
char *util_get_filename(char *path);
|
||||
|
||||
#endif // UTIL_UTIL_H_
|
||||
|
Reference in New Issue
Block a user