mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
common/array.h: add wl_array_for_each_reverse macro
This commit is contained in:
parent
4d679801ad
commit
042215f856
2 changed files with 12 additions and 0 deletions
|
|
@ -30,4 +30,15 @@ wl_array_len(struct wl_array *array)
|
|||
return array->size / sizeof(const char *);
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterates in reverse over an array.
|
||||
* @pos: pointer that each array element will be assigned to
|
||||
* @array: wl_array to iterate over
|
||||
*/
|
||||
#define wl_array_for_each_reverse(pos, array) \
|
||||
for (pos = !(array)->data ? NULL \
|
||||
: (void *)((const char *)(array)->data + (array)->size - sizeof(pos)); \
|
||||
pos && (const char *)pos >= (const char *)(array)->data; \
|
||||
(pos)--)
|
||||
|
||||
#endif /* LABWC_ARRAY_H */
|
||||
|
|
|
|||
1
scripts/checkpatch.pl
vendored
1
scripts/checkpatch.pl
vendored
|
|
@ -5531,6 +5531,7 @@ sub process {
|
|||
#
|
||||
if ($starts_with_if_while_etc && !length($s)
|
||||
&& $filename ne "include/view.h"
|
||||
&& $filename ne "include/common/array.h"
|
||||
&& $filename ne "include/ssd-internal.h") {
|
||||
CHK("BRACES", "[labwc-custom] open brace { expected after if/while/for/switch - even with single statement blocks");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue