links: use n_output_lists for link_t

This commit is contained in:
Kamil Trzcinski
2023-02-24 19:59:51 +01:00
parent 17fc87a2d8
commit f7f4eba9ca
5 changed files with 18 additions and 12 deletions

View File

@ -60,3 +60,8 @@ int ioctl_retried(const char *name, int fd, int request, void *arg);
LOG_ERROR(dev, "ioctl(ret=%d, errno=%d): " _msg, ret, errno, ##__VA_ARGS__); \
} \
} while(0)
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
#define ARRAY_APPEND(arr, n_arr, item) ((n_arr) < ARRAY_SIZE(arr) ? ((arr[n_arr++] = item), true) : false)
#define ARRAY_FOREACH(type, key, arr, n_arr) \
for (type *key = &arr[0]; key < &arr[n_arr]; key++)