-/* $OpenBSD: aux.c,v 1.28 2015/10/13 08:49:51 guenther Exp $ */
+/* $OpenBSD: aux.c,v 1.29 2015/10/16 17:56:07 mmcc Exp $ */
/* $NetBSD: aux.c,v 1.5 1997/05/13 06:15:52 mikel Exp $ */
/*
return(name);
/* We assume that length(input) <= length(output) */
- if ((nbuf = (char *)malloc(strlen(name) + 1)) == NULL)
- errx(1, "Out of memory");
+ if ((nbuf = malloc(strlen(name) + 1)) == NULL)
+ err(1, "malloc");
gotlt = 0;
lastsp = 0;
bufend = nbuf;
}
*cp2 = 0;
- if ((cp = (char *)realloc(nbuf, strlen(nbuf) + 1)) != NULL)
+ if ((cp = realloc(nbuf, strlen(nbuf) + 1)) != NULL)
nbuf = cp;
return(nbuf);
}
-/* $OpenBSD: cmd2.c,v 1.21 2014/03/16 18:38:30 guenther Exp $ */
+/* $OpenBSD: cmd2.c,v 1.22 2015/10/16 17:56:07 mmcc Exp $ */
/* $NetBSD: cmd2.c,v 1.7 1997/05/17 19:55:10 pk Exp $ */
/*
if (member(field, tab))
continue;
h = hash(field);
- igp = (struct ignore *)calloc(1, sizeof(struct ignore));
+ igp = calloc(1, sizeof(struct ignore));
if (igp == NULL)
- errx(1, "Out of memory");
+ err(1, "calloc");
igp->i_field = strdup(field);
if (igp->i_field == NULL)
- errx(1, "Out of memory");
+ err(1, "strdup");
igp->i_link = tab->i_head[h];
tab->i_head[h] = igp;
tab->i_count++;
-/* $OpenBSD: cmd3.c,v 1.26 2015/01/20 16:59:07 millert Exp $ */
+/* $OpenBSD: cmd3.c,v 1.27 2015/10/16 17:56:07 mmcc Exp $ */
/* $NetBSD: cmd3.c,v 1.8 1997/07/09 05:29:49 mikel Exp $ */
/*
gname = *argv;
h = hash(gname);
if ((gh = findgroup(gname)) == NULL) {
- if ((gh = (struct grouphead *)calloc(1, sizeof(*gh))) == NULL)
- errx(1, "Out of memory");
+ if ((gh = calloc(1, sizeof(*gh))) == NULL)
+ err(1, "calloc");
gh->g_name = vcopy(gname);
gh->g_list = NULL;
gh->g_link = groups[h];
*/
for (ap = argv+1; *ap != NULL; ap++) {
- if ((gp = (struct group *)calloc(1, sizeof(*gp))) == NULL)
- errx(1, "Out of memory");
+ if ((gp = calloc(1, sizeof(*gp))) == NULL)
+ err(1, "calloc");
gp->ge_name = vcopy(*ap);
gp->ge_link = gh->g_list;
gh->g_list = gp;
}
if (altnames != 0)
(void)free(altnames);
- if ((altnames = (char **)calloc(c, sizeof(char *))) == NULL)
- errx(1, "Out of memory");
+ if ((altnames = calloc(c, sizeof(char *))) == NULL)
+ err(1, "calloc");
for (ap = namelist, ap2 = altnames; *ap; ap++, ap2++) {
if ((*ap2 = strdup(*ap)) == NULL)
- errx(1, "Out of memory");
+ err(1, "strdup");
}
*ap2 = 0;
return(0);
-/* $OpenBSD: fio.c,v 1.34 2014/12/16 18:31:06 millert Exp $ */
+/* $OpenBSD: fio.c,v 1.35 2015/10/16 17:56:07 mmcc Exp $ */
/* $NetBSD: fio.c,v 1.8 1997/07/07 22:57:55 phil Exp $ */
/*
struct message *nmessage;
size = (msgCount + 1) * sizeof(struct message);
- nmessage = (struct message *)realloc(message, size);
+ nmessage = realloc(message, size);
if (nmessage == 0)
- errx(1, "Insufficient memory for %d messages",
- msgCount);
+ err(1, "realloc");
if (omsgCount == 0 || message == NULL)
dot = nmessage;
else
-/* $OpenBSD: lex.c,v 1.38 2014/10/26 20:38:13 guenther Exp $ */
+/* $OpenBSD: lex.c,v 1.39 2015/10/16 17:56:07 mmcc Exp $ */
/* $NetBSD: lex.c,v 1.10 1997/05/17 19:55:13 pk Exp $ */
/*
msize = (n + 1) * sizeof(*msgvec);
if ((msgvec2 = realloc(msgvec, msize)) == NULL)
- errx(1, "Out of memory");
+ err(1, "realloc");
msgvec = msgvec2;
memset(msgvec, 0, msize);
}
-/* $OpenBSD: list.c,v 1.19 2014/01/17 18:42:30 okan Exp $ */
+/* $OpenBSD: list.c,v 1.20 2015/10/16 17:56:07 mmcc Exp $ */
/* $NetBSD: list.c,v 1.7 1997/07/09 05:23:36 mikel Exp $ */
/*
char *linebuf, *linebuf2;
size_t newsize, linebufsize = BUFSIZ;
- if ((linebuf = (char *)malloc(linebufsize)) == NULL)
- errx(1, "Out of memory");
+ if ((linebuf = malloc(linebufsize)) == NULL)
+ err(1, "malloc");
argn = 0;
cp = line;
newsize = linebufsize + BUFSIZ;
linebuf2 = realloc(linebuf, newsize);
if (linebuf2 == NULL)
- errx(1, "Out of memory");
+ err(1, "realloc");
linebuf = linebuf2;
linebufsize = newsize;
cp2 = linebuf + linebufsize - BUFSIZ - 1;
-/* $OpenBSD: names.c,v 1.22 2015/01/20 16:59:07 millert Exp $ */
+/* $OpenBSD: names.c,v 1.23 2015/10/16 17:56:07 mmcc Exp $ */
/* $NetBSD: names.c,v 1.5 1996/06/08 19:48:32 christos Exp $ */
/*
if (line == NULL || *line == '\0')
return(NULL);
- if ((nbuf = (char *)malloc(strlen(line) + 1)) == NULL)
- errx(1, "Out of memory");
+ if ((nbuf = malloc(strlen(line) + 1)) == NULL)
+ err(1, "malloc");
top = NULL;
np = NULL;
cp = line;
-/* $OpenBSD: popen.c,v 1.37 2015/01/16 06:40:09 deraadt Exp $ */
+/* $OpenBSD: popen.c,v 1.38 2015/10/16 17:56:07 mmcc Exp $ */
/* $NetBSD: popen.c,v 1.6 1997/05/13 06:48:42 mikel Exp $ */
/*
{
struct fp *fpp;
- if ((fpp = (struct fp *)malloc(sizeof(*fpp))) == NULL)
- errx(1, "Out of memory");
+ if ((fpp = malloc(sizeof(*fpp))) == NULL)
+ err(1, "malloc");
fpp->fp = fp;
fpp->pipe = pipe;
fpp->pid = pid;
*cpp = child_freelist;
child_freelist = (*cpp)->link;
} else {
- *cpp = (struct child *)malloc(sizeof(struct child));
+ *cpp = malloc(sizeof(struct child));
if (*cpp == NULL)
- errx(1, "Out of memory");
+ err(1, "malloc");
}
(*cpp)->pid = pid;
(*cpp)->done = (*cpp)->free = 0;
-/* $OpenBSD: strings.c,v 1.9 2009/10/27 23:59:40 deraadt Exp $ */
+/* $OpenBSD: strings.c,v 1.10 2015/10/16 17:56:07 mmcc Exp $ */
/* $NetBSD: strings.c,v 1.5 1996/06/08 19:48:40 christos Exp $ */
/*
errx(1, "String too large");
if (sp->s_topFree == NULL) {
index = sp - &stringdope[0];
- sp->s_topFree = (char *)malloc(STRINGSIZE << index);
+ sp->s_topFree = malloc(STRINGSIZE << index);
if (sp->s_topFree == NULL)
- errx(1, "No room for space %d", index);
+ err(1, "malloc");
sp->s_nextFree = sp->s_topFree;
sp->s_nleft = STRINGSIZE << index;
}
-/* $OpenBSD: temp.c,v 1.15 2009/10/27 23:59:40 deraadt Exp $ */
+/* $OpenBSD: temp.c,v 1.16 2015/10/16 17:56:07 mmcc Exp $ */
/* $NetBSD: temp.c,v 1.5 1996/06/08 19:48:42 christos Exp $ */
/*
if ((tmpdir = getenv("TMPDIR")) == NULL || *tmpdir == '\0')
tmpdir = _PATH_TMP;
if ((tmpdir = strdup(tmpdir)) == NULL)
- errx(1, "Out of memory");
+ err(1, "strdup");
/* Strip trailing '/' if necessary */
cp = tmpdir + strlen(tmpdir) - 1;
-/* $OpenBSD: vars.c,v 1.12 2009/10/27 23:59:40 deraadt Exp $ */
+/* $OpenBSD: vars.c,v 1.13 2015/10/16 17:56:07 mmcc Exp $ */
/* $NetBSD: vars.c,v 1.4 1996/06/08 19:48:45 christos Exp $ */
/*
h = hash(name);
vp = lookup(name);
if (vp == NULL) {
- if ((vp = (struct var *)calloc(1, sizeof(*vp))) == NULL)
- errx(1, "Out of memory");
+ if ((vp = calloc(1, sizeof(*vp))) == NULL)
+ err(1, "calloc");
vp->v_name = vcopy(name);
vp->v_link = variables[h];
variables[h] = vp;
if (*str == '\0')
return("");
if ((new = strdup(str)) == NULL)
- errx(1, "Out of memory");
+ err(1, "strdup");
return(new);
}