From: Lennart Poettering Date: Mon, 21 Mar 2022 13:24:50 +0000 (+0100) Subject: tree-wide: use PTR_SUB1() at two places where appropriate X-Git-Tag: v251-rc1~54^2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3e3ee42072c4ef5cd1464cbec5d78e5c933fcb14;p=thirdparty%2Fsystemd.git tree-wide: use PTR_SUB1() at two places where appropriate --- diff --git a/src/basic/strv.h b/src/basic/strv.h index c89c0f64e27..2a858326c60 100644 --- a/src/basic/strv.h +++ b/src/basic/strv.h @@ -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)) diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index d245c2c7b39..b46cb0f9066 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -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;