diff options
author | Hung-Te Lin <hungte@chromium.org> | 2013-01-28 15:53:34 +0800 |
---|---|---|
committer | Hung-Te Lin <hungte@chromium.org> | 2013-02-01 06:50:17 +0100 |
commit | 332795cc5951c6d65badd2bbf3c79f6b63dbdbc2 (patch) | |
tree | b6e6d44b49e53b2cf1c99fb80db5e6b20043c340 /util/cbfstool/cbfstool.c | |
parent | d723c5b554786794217a92acb4ce0096bf924da8 (diff) |
cbfstool: Make endian detection functions to work without prior setup.
The 'host_bigendian' variable (and functions relying on it like ntohl/htonl)
requires host detection by calling static which_endian() first -- which may be
easily forgotten by developers. It's now a public function in common.c and
doesn't need initialization anymore.
Change-Id: I13dabd1ad15d2d6657137d29138e0878040cb205
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: http://review.coreboot.org/2199
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Diffstat (limited to 'util/cbfstool/cbfstool.c')
-rw-r--r-- | util/cbfstool/cbfstool.c | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c index 1ad270b057..11f1914e2e 100644 --- a/util/cbfstool/cbfstool.c +++ b/util/cbfstool/cbfstool.c @@ -496,18 +496,6 @@ static void usage(char *name) print_supported_filetypes(); } -/* Small, OS/libc independent runtime check for endianess */ -int host_bigendian = 0; - -static void which_endian(void) -{ - static const uint32_t inttest = 0x12345678; - uint8_t inttest_lsb = *(uint8_t *)&inttest; - if (inttest_lsb == 0x12) { - host_bigendian = 1; - } -} - int main(int argc, char **argv) { size_t i; @@ -518,8 +506,6 @@ int main(int argc, char **argv) return 1; } - which_endian(); - param.cbfs_name = argv[1]; char *cmd = argv[2]; optind += 2; |