diff options
author | Cristian RodrÃguez <crrodriguez@opensuse.org> | 2013-02-26 22:40:16 -0300 |
---|---|---|
committer | Kay Sievers <kay@vrfy.org> | 2013-02-27 12:12:31 +0100 |
commit | 0370e17e6e6edf27e31e1fa257489ffd03ceed7a (patch) | |
tree | 6e082a8a2ccd9c8721e55ffe76ae5f6b5ea8514e | |
parent | 0fd32922ba6044b63adcc1d8ae462bf895390bf8 (diff) | |
download | libabc-0370e17e6e6edf27e31e1fa257489ffd03ceed7a.tar.gz |
improve the recommendations on byteswapping calls
It is very frequent to find userspace code including <asm/byteorder.h>
and/or using/redefining cpu_to_*, *_to_cpu, swabxx from the linux kernel
headers. Add a note asking people to stick to the glibc API.
-rw-r--r-- | README | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -251,8 +251,10 @@ Never expose fixed size strings in your API a buffer, and return ENOSPC if too short. Glibc has byteswapping calls, don't invent your own: - - le32toh(), htole32() and friends - - bswap32() and friends() + - le32toh(), htole32() all those are documented in endian(3) + - bswap_32(), bswap_16(), bswap_64(). #include <byteswap.h> + - Don't use the versions provided by the linux kernel headers cpu_to_*() , *_to_cpu. + stick to the glibc API. Don't typedef pointers to structs! |