diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2005-01-06 03:26:03 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2005-01-06 03:26:03 +0000 |
commit | 1f055673ea156c98a1db397a35178076d5122397 (patch) | |
tree | 476a5b5472c3ca69a7141f50abf9a44fceadc553 /lib/libc | |
parent | c575f5a2130bf9d4b244ae5ab5420318dad910c1 (diff) |
Replace bcopy() with memcpy() and memmove() so it is obvious what
is a move and what is a copy. Also remove an unneeded variable.
No functional change.
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/getcwd.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/libc/gen/getcwd.c b/lib/libc/gen/getcwd.c index bbc753b6ec0..bd7cd128364 100644 --- a/lib/libc/gen/getcwd.c +++ b/lib/libc/gen/getcwd.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: getcwd.c,v 1.10 2005/01/05 19:48:08 otto Exp $"; +static char rcsid[] = "$OpenBSD: getcwd.c,v 1.11 2005/01/06 03:26:02 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -118,7 +118,7 @@ getcwd(char *pt, size_t size) * path to the beginning of the buffer, but it's always * been that way and stuff would probably break. */ - bcopy(bpt, pt, ept - bpt); + memmove(pt, bpt, ept - bpt); free(up); return (pt); } @@ -167,7 +167,7 @@ getcwd(char *pt, size_t size) goto notfound; if (ISDOT(dp)) continue; - bcopy(dp->d_name, bup, dp->d_namlen + 1); + memcpy(bup, dp->d_name, dp->d_namlen + 1); /* Save the first error for later. */ if (lstat(up, &s)) { @@ -185,27 +185,26 @@ getcwd(char *pt, size_t size) * leading slash. */ if (bpt - pt < dp->d_namlen + (first ? 1 : 2)) { - size_t len, off; + size_t len; char *npt; if (!ptsize) { errno = ERANGE; goto err; } - off = bpt - pt; len = ept - bpt; if ((npt = realloc(pt, ptsize *= 2)) == NULL) goto err; + bpt = npt + (bpt - pt); pt = npt; - bpt = pt + off; ept = pt + ptsize; - bcopy(bpt, ept - len, len); + memmove(ept - len, bpt, len); bpt = ept - len; } if (!first) *--bpt = '/'; bpt -= dp->d_namlen; - bcopy(dp->d_name, bpt, dp->d_namlen); + memcpy(bpt, dp->d_name, dp->d_namlen); (void)closedir(dir); /* Truncate any file name. */ |