tree-wide: use PTR_SUB1() at two places where appropriate

This commit is contained in:
Lennart Poettering
2022-03-23 21:57:25 +09:00
committed by Yu Watanabe
parent 50996f04ad
commit 3e3ee42072
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -134,7 +134,7 @@ bool strv_overlap(char * const *a, char * const *b) _pure_;
_len > 0 ? h + _len - 1 : NULL; \
}); \
(s = i); \
i > h ? i-- : (i = NULL))
i = PTR_SUB1(i, h))
#define STRV_FOREACH_BACKWARDS(s, l) \
_STRV_FOREACH_BACKWARDS(s, l, UNIQ_T(h, UNIQ), UNIQ_T(i, UNIQ))
+1 -1
View File
@@ -1830,7 +1830,7 @@ static int udev_rule_apply_token_to_event(
bool found = false;
/* Drop the last line. */
for (char *p = buf + strlen(buf) - 1; p >= buf; p--)
for (char *p = PTR_SUB1(buf + strlen(buf), buf); p; p = PTR_SUB1(p, buf))
if (strchr(NEWLINE, *p)) {
*p = '\0';
found = true;