]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: use ALIGN_PTR()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 31 May 2022 18:06:57 +0000 (03:06 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 31 May 2022 18:12:33 +0000 (03:12 +0900)
src/basic/static-destruct.h
src/libsystemd/sd-bus/bus-error.c
src/libsystemd/sd-bus/test-bus-error.c
src/shared/tests.h

index a41c0e30d53208f90585c00a55593dd1c548c9dd..97baac7abb0c07568e317f1425ccd9856c88afa8 100644 (file)
@@ -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);
         }
 }
index bdfa145ab7d640bc69c65737cd793ee258dcf2da..2454a95b9db55683f8b8a6a53a246524ef456364 100644 (file)
@@ -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;
                 }
 
index 952455255dc1e2addb91568c09c5e6743783fea5..cc59de12b4d8c830a4af7828951b0024ee6980f5 100644 (file)
@@ -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;
                 }
 
index ade527590bc50d0b1b4346af7e6805126ffff608..a2f7f38c41e0b2b440cc65ea12124ce556cc47fc 100644 (file)
@@ -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;