From: Yu Watanabe Date: Tue, 31 May 2022 18:06:57 +0000 (+0900) Subject: tree-wide: use ALIGN_PTR() X-Git-Tag: v252-rc1~891^2~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=394129f88b54a8a0886fe0f9867e2e9603eb0694;p=thirdparty%2Fsystemd.git tree-wide: use ALIGN_PTR() --- diff --git a/src/basic/static-destruct.h b/src/basic/static-destruct.h index a41c0e30d53..97baac7abb0 100644 --- a/src/basic/static-destruct.h +++ b/src/basic/static-destruct.h @@ -55,9 +55,9 @@ static inline void static_destruct(void) { if (!__start_SYSTEMD_STATIC_DESTRUCT) return; - d = ALIGN_TO_PTR(__start_SYSTEMD_STATIC_DESTRUCT, sizeof(void*)); + d = ALIGN_PTR(__start_SYSTEMD_STATIC_DESTRUCT); while (d < __stop_SYSTEMD_STATIC_DESTRUCT) { d->destroy(d->data); - d = ALIGN_TO_PTR(d + 1, sizeof(void*)); + d = ALIGN_PTR(d + 1); } } diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c index bdfa145ab7d..2454a95b9db 100644 --- a/src/libsystemd/sd-bus/bus-error.c +++ b/src/libsystemd/sd-bus/bus-error.c @@ -92,7 +92,7 @@ static int bus_error_name_to_errno(const char *name) { } } - m = ALIGN_TO_PTR(__start_SYSTEMD_BUS_ERROR_MAP, sizeof(void*)); + m = ALIGN_PTR(__start_SYSTEMD_BUS_ERROR_MAP); while (m < __stop_SYSTEMD_BUS_ERROR_MAP) { /* For magic ELF error maps, the end marker might * appear in the middle of things, since multiple maps @@ -101,7 +101,7 @@ static int bus_error_name_to_errno(const char *name) { * boundary, which is the selected alignment for the * arrays. */ if (m->code == BUS_ERROR_MAP_END_MARKER) { - m = ALIGN_TO_PTR(m + 1, sizeof(void*)); + m = ALIGN_PTR(m + 1); continue; } diff --git a/src/libsystemd/sd-bus/test-bus-error.c b/src/libsystemd/sd-bus/test-bus-error.c index 952455255dc..cc59de12b4d 100644 --- a/src/libsystemd/sd-bus/test-bus-error.c +++ b/src/libsystemd/sd-bus/test-bus-error.c @@ -131,11 +131,11 @@ static int dump_mapping_table(void) { const sd_bus_error_map *m; printf("----- errno mappings ------\n"); - m = ALIGN_TO_PTR(__start_SYSTEMD_BUS_ERROR_MAP, sizeof(void*)); + m = ALIGN_PTR(__start_SYSTEMD_BUS_ERROR_MAP); while (m < __stop_SYSTEMD_BUS_ERROR_MAP) { if (m->code == BUS_ERROR_MAP_END_MARKER) { - m = ALIGN_TO_PTR(m + 1, sizeof(void*)); + m = ALIGN_PTR(m + 1); continue; } diff --git a/src/shared/tests.h b/src/shared/tests.h index ade527590bc..a2f7f38c41e 100644 --- a/src/shared/tests.h +++ b/src/shared/tests.h @@ -88,7 +88,7 @@ static inline int run_test_table(void) { if (!__start_SYSTEMD_TEST_TABLE) return r; - const TestFunc *t = ALIGN_TO_PTR(__start_SYSTEMD_TEST_TABLE, sizeof(TestFunc*)); + const TestFunc *t = ALIGN_PTR(__start_SYSTEMD_TEST_TABLE); while (t < __stop_SYSTEMD_TEST_TABLE) { if (t->sd_booted && sd_booted() <= 0) { @@ -106,7 +106,7 @@ static inline int run_test_table(void) { t->f.void_func(); } - t = ALIGN_TO_PTR(t + 1, sizeof(TestFunc*)); + t = ALIGN_PTR(t + 1); } return r;