diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-08-08 05:27:37 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-08-08 05:27:37 +0000 |
commit | 62a7b2c54013b0f7e312cb439ce865cd24884bd8 (patch) | |
tree | 0b45ab13022d1a293b6c26a2b211b2415e4e563e /libc/unistd | |
parent | 513df600f4396f2e212a3c9216d820e49bf0b7c4 (diff) |
Avoid bad things happening on macro expansion...
-Erik
Diffstat (limited to 'libc/unistd')
-rw-r--r-- | libc/unistd/swab.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libc/unistd/swab.c b/libc/unistd/swab.c index 41845d4cb..70ea464c2 100644 --- a/libc/unistd/swab.c +++ b/libc/unistd/swab.c @@ -11,8 +11,13 @@ void swab (const void *source, void *dest, ssize_t count) { const unsigned short *from = source, *from_end = from + (count >> 1); + unsigned short junk; unsigned short *to = dest; - while (from < from_end) - *to++ = bswap_16 (*from++); + while (from < from_end) { + /* Don't put '*from++'into the bswap_16() macros + * or mad things will happen on macro expansion */ + junk=*from++; + *to++ = bswap_16 (junk); + } } |