aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristian Rodríguez <crrodriguez@opensuse.org>2013-02-26 22:40:16 -0300
committerKay Sievers <kay@vrfy.org>2013-02-27 12:12:31 +0100
commit0370e17e6e6edf27e31e1fa257489ffd03ceed7a (patch)
tree6e082a8a2ccd9c8721e55ffe76ae5f6b5ea8514e
parent0fd32922ba6044b63adcc1d8ae462bf895390bf8 (diff)
downloadlibabc-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--README6
1 files changed, 4 insertions, 2 deletions
diff --git a/README b/README
index b4bed51..bb06cad 100644
--- a/README
+++ b/README
@@ -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!