]> git.ipfire.org Git - thirdparty/systemd.git/commit
tree-wide: get rid of most uses of ALIGN_PTR
authorZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Sat, 16 May 2026 16:32:14 +0000 (18:32 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Sat, 16 May 2026 16:32:14 +0000 (18:32 +0200)
commitcf889036377092cbec6c5ec86fdf0dc1c9326032
tree6e53dc334a7cd38360776e35c469b88d3bcc37d5
parent3b37439afb88cfe55e111ad1a5421bd57405b3b9
tree-wide: get rid of most uses of ALIGN_PTR

This bothered me for a while, but I didn't think too much about it and just
copied the existing usage pattern. But it really doesn't make sense. We expect
the compiler to align the section properly. But if it didn't align it, applying
alignment after the fact would just cause our pointer to point to the middle
of the structure. That'd be even worse than a misaligned pointer.

Similarly, when doing pointer arithmetic, p++ should really result in a value
with the appropriate alignment. This is the basic principle of C pointer
addition. So we really shouldn't try to adjust the pointer ourselves. At most,
we can assert that it is indeed aligned in tests.
src/basic/static-destruct.c
src/basic/static-destruct.h
src/libsystemd/sd-bus/bus-error.c
src/libsystemd/sd-bus/test-bus-error.c
src/shared/options.h
src/shared/tests.c
src/shared/verbs.c
src/shared/verbs.h
src/systemctl/systemctl.c