projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add include files to get prototype declarations, and fix bugs found.
[unix-history]
/
usr
/
src
/
lib
/
libc
/
string
/
swab.c
diff --git
a/usr/src/lib/libc/string/swab.c
b/usr/src/lib/libc/string/swab.c
index
dc0b9cb
..
69417db
100644
(file)
--- a/
usr/src/lib/libc/string/swab.c
+++ b/
usr/src/lib/libc/string/swab.c
@@
-9,23
+9,24
@@
*/
#if defined(LIBC_SCCS) && !defined(lint)
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)swab.c 5.
7
(Berkeley) %G%";
+static char sccsid[] = "@(#)swab.c 5.
9
(Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
#include <string.h>
void
swab(from, to, n)
#endif /* LIBC_SCCS and not lint */
#include <string.h>
void
swab(from, to, n)
- register char *from, *to;
+ const void *from;
+ void *to;
register size_t n;
{
register size_t n;
{
+ register char *fp, *tp;
register unsigned long temp;
register unsigned long temp;
- if (!n)
- return;
-
n >>= 1; n++;
n >>= 1; n++;
-#define STEP temp = *from++,*to++ = *from++,*to++ = temp
+ fp = (char *)from;
+ tp = (char *)to;
+#define STEP temp = *fp++,*tp++ = *fp++,*tp++ = temp
/* round to multiple of 8 */
while ((--n) & 07)
STEP;
/* round to multiple of 8 */
while ((--n) & 07)
STEP;