]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: use PTR_SUB1() at two places where appropriate
authorLennart Poettering <lennart@poettering.net>
Mon, 21 Mar 2022 13:24:50 +0000 (14:24 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 23 Mar 2022 12:57:25 +0000 (21:57 +0900)
src/basic/strv.h
src/udev/udev-rules.c

index c89c0f64e27078032e3ddd910b03d18739a7c5f2..2a858326c608ee6869eca3d42af1dcbdf205256c 100644 (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))
index d245c2c7b39624fa520acc1fb7ed927f99cf481c..b46cb0f9066981baa9cd4042ca662c919d6fa4b5 100644 (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;