treewide nit: avoid NULL arithmetics
(u)intptr_t casts seem the best in terms of compliance: https://stackoverflow.com/q/45220134/587396
Otherwise with clang 18 we can get warnings like
../$path:$line:$col: runtime error: applying non-zero offset $num to null pointer
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../$path:$line:$col