summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2001-07-24 14:06:19 +0000
committerobrien <obrien@FreeBSD.org>2001-07-24 14:06:19 +0000
commit9032757ec8b632bf62151d42b7016465752f99c3 (patch)
tree82606876fbef64ad3b1d8079a88e52aa5702059d /usr.bin
parent6dc73139c0963b16a0a8642e6399a5433348138e (diff)
downloadFreeBSD-src-9032757ec8b632bf62151d42b7016465752f99c3.zip
FreeBSD-src-9032757ec8b632bf62151d42b7016465752f99c3.tar.gz
Expand emalloc in-place, and remove the `rname' basename() implimenation.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ranlib/build.c10
-rw-r--r--usr.bin/ranlib/misc.c20
2 files changed, 6 insertions, 24 deletions
diff --git a/usr.bin/ranlib/build.c b/usr.bin/ranlib/build.c
index b4d8bc6..6768257 100644
--- a/usr.bin/ranlib/build.c
+++ b/usr.bin/ranlib/build.c
@@ -143,7 +143,6 @@ rexec(rfd, wfd)
struct nlist nl;
off_t r_off, w_off;
long strsize;
- void *emalloc();
/* Get current offsets for original and tmp files. */
r_off = lseek(rfd, (off_t)0, SEEK_CUR);
@@ -169,7 +168,8 @@ rexec(rfd, wfd)
/* Read in the string table. */
strsize -= sizeof(strsize);
- strtab = emalloc(strsize);
+ if ((strtab = malloc(strsize)) == NULL)
+ error(archive);
nr = read(rfd, strtab, strsize);
if (nr != strsize) {
badread: if (nr < 0)
@@ -205,8 +205,10 @@ badread: if (nr < 0)
sym = strtab + nl.n_un.n_strx - sizeof(long);
symlen = strlen(sym) + 1;
- rp = (RLIB *)emalloc(sizeof(RLIB));
- rp->sym = (char *)emalloc(symlen);
+ if ((rp = malloc(sizeof(RLIB))) == NULL)
+ error(archive);
+ if ((rp->sym = malloc(symlen)) == NULL)
+ error(archive);
bcopy(sym, rp->sym, symlen);
rp->symlen = symlen;
rp->pos = w_off;
diff --git a/usr.bin/ranlib/misc.c b/usr.bin/ranlib/misc.c
index 19b4854..85a5f8c 100644
--- a/usr.bin/ranlib/misc.c
+++ b/usr.bin/ranlib/misc.c
@@ -79,26 +79,6 @@ tmp(void)
return(fd);
}
-void *
-emalloc(len)
- int len;
-{
- void *p;
-
- if ((p = malloc((u_int)len)) == NULL)
- error(archive);
- return(p);
-}
-
-char *
-rname(path)
- char *path;
-{
- register char *ind;
-
- return((ind = rindex(path, '/')) ? ind + 1 : path);
-}
-
void
badfmt(void)
{
OpenPOWER on IntegriCloud