mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-26 14:27:14 +00:00
Commit 43bf8a4ded introduced endian
dependend byte-swapping code in include/asterisk/utils.h, where the
endianness was detected using the __BYTE_ORDER macro. This macro
lives in endian.h, which on Linux is included implicitely (by the
network-related headers, I think), but on FreeBSD the headers are
laid out differently and we do not get __BYTE_ORDER the implicit way.
Instead, this makes the usage of endian.h explicit by including it
where we need it, and switches the BYTE_ORDER/*ENDIAN macros to the
POSIX-defined ones (see
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/endian.h.html
for standard compliance). Additionally, this adds a compile-time check
for the endianness-logic: compilation will fail if neither big nor
little endian can be detected.
Fixes: #1536