2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-09-05 00:35:13 +00:00

Convert to htoleXX fns instead of ifdef on endian

This patch makes use of the htoleXX() functions (see endian(3))
defined as part of endian.h (already included in parser_interface.c),
instead of defining a function differently based on the detection of
endian related macros.

This fixes a build failure experienced on powerpc with John's patch
set applied. This patch has been updated with John's feedback to use
letoh16() in the le16_to_cpu() macro.


Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
This commit is contained in:
John Johansen
2014-04-23 11:07:49 -07:00
parent 564ffd3c8d
commit 746cecf4b7
3 changed files with 7 additions and 17 deletions

View File

@@ -946,11 +946,7 @@ int test_for_dir_mode(const char *basename, const char *linkdir)
return rc;
}
#if __BYTE_ORDER == __BIG_ENDIAN
# define le16_to_cpu(x) ((uint16_t)(bswap_16 (*(uint16_t *) x)))
#else
# define le16_to_cpu(x) (*(uint16_t *)(x))
#endif
#define le16_to_cpu(x) ((uint16_t)(le16toh (*(uint16_t *) x)))
const char header_string[] = "\004\010\000version\000\002";
#define HEADER_STRING_SIZE 12