summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/rcs/buf.c12
-rw-r--r--usr.bin/rcs/ci.c30
-rw-r--r--usr.bin/rcs/co.c4
-rw-r--r--usr.bin/rcs/date.y4
-rw-r--r--usr.bin/rcs/diff.c17
-rw-r--r--usr.bin/rcs/diff3.c44
-rw-r--r--usr.bin/rcs/rcs.c97
-rw-r--r--usr.bin/rcs/rcsdiff.c14
-rw-r--r--usr.bin/rcs/rcsnum.c10
-rw-r--r--usr.bin/rcs/rcsparse.c13
-rw-r--r--usr.bin/rcs/rcsprog.c9
-rw-r--r--usr.bin/rcs/rcsutil.c29
-rw-r--r--usr.bin/rcs/worklist.c5
-rw-r--r--usr.bin/rcs/xmalloc.c10
-rw-r--r--usr.bin/rcs/xmalloc.h3
15 files changed, 125 insertions, 176 deletions
diff --git a/usr.bin/rcs/buf.c b/usr.bin/rcs/buf.c
index a3c529c1493..7c7931567d9 100644
--- a/usr.bin/rcs/buf.c
+++ b/usr.bin/rcs/buf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buf.c,v 1.24 2015/02/05 12:59:58 millert Exp $ */
+/* $OpenBSD: buf.c,v 1.25 2015/06/13 20:15:21 nicm Exp $ */
/*
* Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -32,6 +32,7 @@
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -137,15 +138,14 @@ out:
void
buf_free(BUF *b)
{
- if (b->cb_buf != NULL)
- xfree(b->cb_buf);
- xfree(b);
+ free(b->cb_buf);
+ free(b);
}
/*
* Free the buffer <b>'s structural information but do not free the contents
* of the buffer. Instead, they are returned and should be freed later using
- * xfree().
+ * free().
*/
void *
buf_release(BUF *b)
@@ -153,7 +153,7 @@ buf_release(BUF *b)
void *tmp;
tmp = b->cb_buf;
- xfree(b);
+ free(b);
return (tmp);
}
diff --git a/usr.bin/rcs/ci.c b/usr.bin/rcs/ci.c
index 1ec9aeceed1..c91630a1ee8 100644
--- a/usr.bin/rcs/ci.c
+++ b/usr.bin/rcs/ci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ci.c,v 1.219 2015/01/16 06:40:11 deraadt Exp $ */
+/* $OpenBSD: ci.c,v 1.220 2015/06/13 20:15:21 nicm Exp $ */
/*
* Copyright (c) 2005, 2006 Niall O'Higgins <niallo@openbsd.org>
* All rights reserved.
@@ -211,7 +211,7 @@ checkin_main(int argc, char **argv)
exit(0);
case 'w':
if (pb.author != NULL)
- xfree(pb.author);
+ free(pb.author);
pb.author = xstrdup(rcs_optarg);
break;
case 'x':
@@ -376,10 +376,8 @@ out:
buf_free(b2);
if (b3 != NULL)
buf_free(b3);
- if (path1 != NULL)
- xfree(path1);
- if (path2 != NULL)
- xfree(path2);
+ free(path1);
+ free(path2);
return (NULL);
}
@@ -511,7 +509,7 @@ checkin_update(struct checkin_params *pb)
fprintf(stderr,
"reuse log message of previous file? [yn](y): ");
if (rcs_yesno('y') != 'y') {
- xfree(pb->rcs_msg);
+ free(pb->rcs_msg);
pb->rcs_msg = NULL;
}
}
@@ -584,7 +582,7 @@ checkin_update(struct checkin_params *pb)
pb->username, pb->author, NULL, NULL);
if ((pb->flags & INTERACTIVE) && (pb->rcs_msg[0] == '\0')) {
- xfree(pb->rcs_msg); /* free empty log message */
+ free(pb->rcs_msg); /* free empty log message */
pb->rcs_msg = NULL;
}
@@ -988,25 +986,22 @@ checkin_parsekeyword(char *keystring, RCSNUM **rev, time_t *date,
(void)xasprintf(&datestring, "%s %s", tokens[3], tokens[4]);
if ((*date = date_parse(datestring)) == -1)
errx(1, "could not parse date");
- xfree(datestring);
+ free(datestring);
if (i < 6)
break;
- if (*author != NULL)
- xfree(*author);
+ free(*author);
*author = xstrdup(tokens[5]);
if (i < 7)
break;
- if (*state != NULL)
- xfree(*state);
+ free(*state);
*state = xstrdup(tokens[6]);
break;
case KW_TYPE_AUTHOR:
if (i < 2)
break;
- if (*author != NULL)
- xfree(*author);
+ free(*author);
*author = xstrdup(tokens[1]);
break;
case KW_TYPE_DATE:
@@ -1015,13 +1010,12 @@ checkin_parsekeyword(char *keystring, RCSNUM **rev, time_t *date,
(void)xasprintf(&datestring, "%s %s", tokens[1], tokens[2]);
if ((*date = date_parse(datestring)) == -1)
errx(1, "could not parse date");
- xfree(datestring);
+ free(datestring);
break;
case KW_TYPE_STATE:
if (i < 2)
break;
- if (*state != NULL)
- xfree(*state);
+ free(*state);
*state = xstrdup(tokens[1]);
break;
case KW_TYPE_REVISION:
diff --git a/usr.bin/rcs/co.c b/usr.bin/rcs/co.c
index ce050de96a5..fb987eba115 100644
--- a/usr.bin/rcs/co.c
+++ b/usr.bin/rcs/co.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: co.c,v 1.120 2015/01/16 06:40:11 deraadt Exp $ */
+/* $OpenBSD: co.c,v 1.121 2015/06/13 20:15:21 nicm Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
@@ -554,7 +554,7 @@ checkout_file_has_diffs(RCSFILE *rfp, RCSNUM *frev, const char *dst)
buf_free(bp);
unlink(tempfile);
- xfree(tempfile);
+ free(tempfile);
return (ret);
}
diff --git a/usr.bin/rcs/date.y b/usr.bin/rcs/date.y
index 1da932ee981..aa6200a1d68 100644
--- a/usr.bin/rcs/date.y
+++ b/usr.bin/rcs/date.y
@@ -1,5 +1,5 @@
%{
-/* $OpenBSD: date.y,v 1.12 2013/12/03 00:21:49 deraadt Exp $ */
+/* $OpenBSD: date.y,v 1.13 2015/06/13 20:15:21 nicm Exp $ */
/*
** Originally written by Steven M. Bellovin <smb@research.att.com> while
@@ -494,7 +494,7 @@ yyerror(const char *s)
s, yyInput);
warnx("%s", str);
- xfree(str);
+ free(str);
return (0);
}
diff --git a/usr.bin/rcs/diff.c b/usr.bin/rcs/diff.c
index 1d0a4577166..da9649d8c41 100644
--- a/usr.bin/rcs/diff.c
+++ b/usr.bin/rcs/diff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.37 2015/01/16 06:40:11 deraadt Exp $ */
+/* $OpenBSD: diff.c,v 1.38 2015/06/13 20:15:21 nicm Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
* All rights reserved.
@@ -72,6 +72,7 @@
#include <stdint.h>
#include <stddef.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
@@ -374,13 +375,13 @@ diffreg(const char *file1, const char *file2, BUF *out, int flags)
clistlen = 100;
clist = xcalloc(clistlen, sizeof(*clist));
i = stone(class, slen[0], member, klist, flags);
- xfree(member);
- xfree(class);
+ free(member);
+ free(class);
J = xreallocarray(J, len[0] + 2, sizeof(*J));
unravel(klist[i]);
- xfree(clist);
- xfree(klist);
+ free(clist);
+ free(klist);
ixold = xreallocarray(ixold, len[0] + 2, sizeof(*ixold));
ixnew = xreallocarray(ixnew, len[1] + 2, sizeof(*ixnew));
@@ -769,7 +770,7 @@ unsort(struct line *f, int l, int *b)
a[f[i].serial] = f[i].value;
for (i = 1; i <= l; i++)
b[i] = a[i];
- xfree(a);
+ free(a);
}
static int
@@ -860,7 +861,7 @@ ignoreline(char *line)
int ret;
ret = regexec(diff_ignore_re, line, 0, NULL, 0);
- xfree(line);
+ free(line);
return (ret == 0); /* if it matched, it should be ignored. */
}
@@ -1383,5 +1384,5 @@ diff_output(const char *fmt, ...)
buf_append(diffbuf, str, strlen(str));
else
printf("%s", str);
- xfree(str);
+ free(str);
}
diff --git a/usr.bin/rcs/diff3.c b/usr.bin/rcs/diff3.c
index 27b57ea4d91..39c37e6ad79 100644
--- a/usr.bin/rcs/diff3.c
+++ b/usr.bin/rcs/diff3.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff3.c,v 1.35 2015/01/16 06:40:11 deraadt Exp $ */
+/* $OpenBSD: diff3.c,v 1.36 2015/06/13 20:15:21 nicm Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
@@ -249,20 +249,13 @@ out:
(void)unlink(dp13);
(void)unlink(dp23);
- if (path1 != NULL)
- xfree(path1);
- if (path2 != NULL)
- xfree(path2);
- if (path3 != NULL)
- xfree(path3);
- if (dp13 != NULL)
- xfree(dp13);
- if (dp23 != NULL)
- xfree(dp23);
- if (data != NULL)
- xfree(data);
- if (patch != NULL)
- xfree(patch);
+ free(path1);
+ free(path2);
+ free(path3);
+ free(dp13);
+ free(dp23);
+ free(data);
+ free(patch);
return (diffb);
}
@@ -376,20 +369,13 @@ out:
(void)unlink(dp13);
(void)unlink(dp23);
- if (path1 != NULL)
- xfree(path1);
- if (path2 != NULL)
- xfree(path2);
- if (path3 != NULL)
- xfree(path3);
- if (dp13 != NULL)
- xfree(dp13);
- if (dp23 != NULL)
- xfree(dp23);
- if (data != NULL)
- xfree(data);
- if (patch != NULL)
- xfree(patch);
+ free(path1);
+ free(path2);
+ free(path3);
+ free(dp13);
+ free(dp23);
+ free(data);
+ free(patch);
return (diffb);
}
diff --git a/usr.bin/rcs/rcs.c b/usr.bin/rcs/rcs.c
index 4db755e0cdc..83135cc7390 100644
--- a/usr.bin/rcs/rcs.c
+++ b/usr.bin/rcs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.82 2015/01/16 06:40:11 deraadt Exp $ */
+/* $OpenBSD: rcs.c,v 1.83 2015/06/13 20:15:21 nicm Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -157,24 +157,24 @@ rcs_close(RCSFILE *rfp)
while (!TAILQ_EMPTY(&(rfp->rf_access))) {
rap = TAILQ_FIRST(&(rfp->rf_access));
TAILQ_REMOVE(&(rfp->rf_access), rap, ra_list);
- xfree(rap->ra_name);
- xfree(rap);
+ free(rap->ra_name);
+ free(rap);
}
while (!TAILQ_EMPTY(&(rfp->rf_symbols))) {
rsp = TAILQ_FIRST(&(rfp->rf_symbols));
TAILQ_REMOVE(&(rfp->rf_symbols), rsp, rs_list);
rcsnum_free(rsp->rs_num);
- xfree(rsp->rs_name);
- xfree(rsp);
+ free(rsp->rs_name);
+ free(rsp);
}
while (!TAILQ_EMPTY(&(rfp->rf_locks))) {
rlp = TAILQ_FIRST(&(rfp->rf_locks));
TAILQ_REMOVE(&(rfp->rf_locks), rlp, rl_list);
rcsnum_free(rlp->rl_num);
- xfree(rlp->rl_name);
- xfree(rlp);
+ free(rlp->rl_name);
+ free(rlp);
}
if (rfp->rf_head != NULL)
@@ -184,17 +184,15 @@ rcs_close(RCSFILE *rfp)
if (rfp->rf_file != NULL)
fclose(rfp->rf_file);
- if (rfp->rf_path != NULL)
- xfree(rfp->rf_path);
- if (rfp->rf_comment != NULL)
- xfree(rfp->rf_comment);
- if (rfp->rf_expand != NULL)
- xfree(rfp->rf_expand);
- if (rfp->rf_desc != NULL)
- xfree(rfp->rf_desc);
+
+ free(rfp->rf_path);
+ free(rfp->rf_comment);
+ free(rfp->rf_expand);
+ free(rfp->rf_desc);
if (rfp->rf_pdata != NULL)
rcsparse_free(rfp);
- xfree(rfp);
+
+ free(rfp);
}
/*
@@ -349,8 +347,7 @@ rcs_write(RCSFILE *rfp)
rfp->rf_flags |= RCS_SYNCED;
- if (fn != NULL)
- xfree(fn);
+ free(fn);
}
/*
@@ -420,7 +417,7 @@ rcs_movefile(char *from, char *to, mode_t perm, u_int to_flags)
out:
(void)fclose(src);
(void)fclose(dst);
- xfree(buf);
+ free(buf);
return (0);
}
@@ -509,8 +506,8 @@ rcs_access_remove(RCSFILE *file, const char *login)
}
TAILQ_REMOVE(&(file->rf_access), ap, ra_list);
- xfree(ap->ra_name);
- xfree(ap);
+ free(ap->ra_name);
+ free(ap);
/* not synced anymore */
file->rf_flags &= ~RCS_SYNCED;
@@ -582,9 +579,9 @@ rcs_sym_remove(RCSFILE *file, const char *sym)
}
TAILQ_REMOVE(&(file->rf_symbols), symp, rs_list);
- xfree(symp->rs_name);
+ free(symp->rs_name);
rcsnum_free(symp->rs_num);
- xfree(symp);
+ free(symp);
/* not synced anymore */
file->rf_flags &= ~RCS_SYNCED;
@@ -743,8 +740,8 @@ rcs_lock_remove(RCSFILE *file, const char *user, RCSNUM *rev)
TAILQ_REMOVE(&(file->rf_locks), lkp, rl_list);
rcsnum_free(lkp->rl_num);
- xfree(lkp->rl_name);
- xfree(lkp);
+ free(lkp->rl_name);
+ free(lkp);
/* not synced anymore */
file->rf_flags &= ~RCS_SYNCED;
@@ -762,8 +759,7 @@ rcs_desc_set(RCSFILE *file, const char *desc)
char *tmp;
tmp = xstrdup(desc);
- if (file->rf_desc != NULL)
- xfree(file->rf_desc);
+ free(file->rf_desc);
file->rf_desc = tmp;
file->rf_flags &= ~RCS_SYNCED;
}
@@ -779,8 +775,7 @@ rcs_comment_set(RCSFILE *file, const char *comment)
char *tmp;
tmp = xstrdup(comment);
- if (file->rf_comment != NULL)
- xfree(file->rf_comment);
+ free(file->rf_comment);
file->rf_comment = tmp;
file->rf_flags &= ~RCS_SYNCED;
}
@@ -839,7 +834,7 @@ rcs_patch_lines(struct rcs_lines *dlines, struct rcs_lines *plines)
for (i = 0; (i < nbln) && (dlp != NULL); i++) {
ndlp = TAILQ_NEXT(dlp, l_list);
TAILQ_REMOVE(&(dlines->l_lines), dlp, l_list);
- xfree(dlp);
+ free(dlp);
dlp = ndlp;
/* last line is gone - reset dlp */
if (dlp == NULL) {
@@ -1020,7 +1015,7 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *frev)
return (NULL);
rbuf = rcs_patchfile(data, dlen, patch, plen, rcs_patch_lines);
- xfree(data);
+ free(data);
if (rbuf == NULL)
break;
@@ -1246,10 +1241,8 @@ rcs_rev_remove(RCSFILE *rf, RCSNUM *rev)
rcs_freedelta(rdp);
- if (path_tmp1 != NULL)
- xfree(path_tmp1);
- if (path_tmp2 != NULL)
- xfree(path_tmp2);
+ free(path_tmp1);
+ free(path_tmp2);
return (0);
}
@@ -1343,8 +1336,7 @@ rcs_kwexp_set(RCSFILE *file, int mode)
}
tmp = xstrdup(buf);
- if (file->rf_expand != NULL)
- xfree(file->rf_expand);
+ free(file->rf_expand);
file->rf_expand = tmp;
/* not synced anymore */
file->rf_flags &= ~RCS_SYNCED;
@@ -1419,24 +1411,19 @@ rcs_freedelta(struct rcs_delta *rdp)
if (rdp->rd_next != NULL)
rcsnum_free(rdp->rd_next);
- if (rdp->rd_author != NULL)
- xfree(rdp->rd_author);
- if (rdp->rd_locker != NULL)
- xfree(rdp->rd_locker);
- if (rdp->rd_state != NULL)
- xfree(rdp->rd_state);
- if (rdp->rd_log != NULL)
- xfree(rdp->rd_log);
- if (rdp->rd_text != NULL)
- xfree(rdp->rd_text);
+ free(rdp->rd_author);
+ free(rdp->rd_locker);
+ free(rdp->rd_state);
+ free(rdp->rd_log);
+ free(rdp->rd_text);
while ((rb = TAILQ_FIRST(&(rdp->rd_branches))) != NULL) {
TAILQ_REMOVE(&(rdp->rd_branches), rb, rb_list);
rcsnum_free(rb->rb_num);
- xfree(rb);
+ free(rb);
}
- xfree(rdp);
+ free(rdp);
}
/*
@@ -1701,8 +1688,7 @@ rcs_deltatext_set(RCSFILE *rfp, RCSNUM *rev, BUF *bp)
if ((rdp = rcs_findrev(rfp, rev)) == NULL)
return (-1);
- if (rdp->rd_text != NULL)
- xfree(rdp->rd_text);
+ free(rdp->rd_text);
len = buf_len(bp);
dtext = buf_release(bp);
@@ -1717,8 +1703,7 @@ rcs_deltatext_set(RCSFILE *rfp, RCSNUM *rev, BUF *bp)
rdp->rd_tlen = 0;
}
- if (dtext != NULL)
- xfree(dtext);
+ free(dtext);
return (0);
}
@@ -1736,8 +1721,7 @@ rcs_rev_setlog(RCSFILE *rfp, RCSNUM *rev, const char *logtext)
if ((rdp = rcs_findrev(rfp, rev)) == NULL)
return (-1);
- if (rdp->rd_log != NULL)
- xfree(rdp->rd_log);
+ free(rdp->rd_log);
rdp->rd_log = xstrdup(logtext);
rfp->rf_flags &= ~RCS_SYNCED;
@@ -1776,8 +1760,7 @@ rcs_state_set(RCSFILE *rfp, RCSNUM *rev, const char *state)
if ((rdp = rcs_findrev(rfp, rev)) == NULL)
return (-1);
- if (rdp->rd_state != NULL)
- xfree(rdp->rd_state);
+ free(rdp->rd_state);
rdp->rd_state = xstrdup(state);
diff --git a/usr.bin/rcs/rcsdiff.c b/usr.bin/rcs/rcsdiff.c
index bd3a3edbdf6..268070bd8bb 100644
--- a/usr.bin/rcs/rcsdiff.c
+++ b/usr.bin/rcs/rcsdiff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsdiff.c,v 1.82 2015/01/16 06:40:11 deraadt Exp $ */
+/* $OpenBSD: rcsdiff.c,v 1.83 2015/06/13 20:15:21 nicm Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
@@ -358,10 +358,8 @@ out:
buf_free(b1);
if (b2 != NULL)
buf_free(b2);
- if (path1 != NULL)
- xfree(path1);
- if (path2 != NULL)
- xfree(path2);
+ free(path1);
+ free(path2);
return (ret);
}
@@ -437,10 +435,8 @@ out:
buf_free(b1);
if (b2 != NULL)
buf_free(b2);
- if (path1 != NULL)
- xfree(path1);
- if (path2 != NULL)
- xfree(path2);
+ free(path1);
+ free(path2);
return (ret);
}
diff --git a/usr.bin/rcs/rcsnum.c b/usr.bin/rcs/rcsnum.c
index 71cc05d848a..69431dabf53 100644
--- a/usr.bin/rcs/rcsnum.c
+++ b/usr.bin/rcs/rcsnum.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsnum.c,v 1.16 2015/01/16 06:40:11 deraadt Exp $ */
+/* $OpenBSD: rcsnum.c,v 1.17 2015/06/13 20:15:21 nicm Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -26,6 +26,7 @@
#include <ctype.h>
#include <err.h>
+#include <stdlib.h>
#include <string.h>
#include <limits.h>
@@ -104,9 +105,8 @@ rcsnum_parse(const char *str)
void
rcsnum_free(RCSNUM *rn)
{
- if (rn->rn_id != NULL)
- xfree(rn->rn_id);
- xfree(rn);
+ free(rn->rn_id);
+ free(rn);
}
/*
@@ -331,7 +331,7 @@ rcsnum_aton(const char *str, char **ep, RCSNUM *nump)
rcsnum_aton_failed:
nump->rn_len = 0;
- xfree(nump->rn_id);
+ free(nump->rn_id);
nump->rn_id = NULL;
return (-1);
}
diff --git a/usr.bin/rcs/rcsparse.c b/usr.bin/rcs/rcsparse.c
index 2328482d29f..0c02edfedf7 100644
--- a/usr.bin/rcs/rcsparse.c
+++ b/usr.bin/rcs/rcsparse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsparse.c,v 1.14 2014/12/01 21:58:46 deraadt Exp $ */
+/* $OpenBSD: rcsparse.c,v 1.15 2015/06/13 20:15:21 nicm Exp $ */
/*
* Copyright (c) 2010 Tobias Stoeckmann <tobias@openbsd.org>
*
@@ -340,11 +340,10 @@ rcsparse_free(RCSFILE *rfp)
pdp = rfp->rf_pdata;
- if (pdp->rp_buf != NULL)
- xfree(pdp->rp_buf);
+ free(pdp->rp_buf);
if (pdp->rp_token == RCS_TYPE_REVISION)
rcsnum_free(pdp->rp_value.rev);
- xfree(pdp);
+ free(pdp);
}
/*
@@ -609,7 +608,7 @@ rcsparse_text(RCSFILE *rfp, struct rcs_pdata *pdp)
memcpy(pdp->rp_delta->rd_text, pdp->rp_buf,
pdp->rp_delta->rd_tlen);
}
- xfree(pdp->rp_value.str);
+ free(pdp->rp_value.str);
return (0);
}
@@ -707,7 +706,7 @@ rcsparse_symbols(RCSFILE *rfp, struct rcs_pdata *pdp)
name = pdp->rp_value.str;
if (rcsparse_token(rfp, RCS_TOK_COLON) != RCS_TOK_COLON ||
rcsparse_token(rfp, RCS_TYPE_NUMBER) != RCS_TYPE_NUMBER) {
- xfree(name);
+ free(name);
return (1);
}
symp = xmalloc(sizeof(*symp));
@@ -741,7 +740,7 @@ rcsparse_locks(RCSFILE *rfp, struct rcs_pdata *pdp)
if (rcsparse_token(rfp, RCS_TOK_COLON) != RCS_TOK_COLON ||
rcsparse_token(rfp, RCS_TYPE_REVISION) !=
RCS_TYPE_REVISION) {
- xfree(name);
+ free(name);
return (1);
}
lkp = xmalloc(sizeof(*lkp));
diff --git a/usr.bin/rcs/rcsprog.c b/usr.bin/rcs/rcsprog.c
index 0029cff4972..adad6a1d596 100644
--- a/usr.bin/rcs/rcsprog.c
+++ b/usr.bin/rcs/rcsprog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsprog.c,v 1.155 2015/01/16 06:40:11 deraadt Exp $ */
+/* $OpenBSD: rcsprog.c,v 1.156 2015/06/13 20:15:21 nicm Exp $ */
/*
* Copyright (c) 2005 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -242,8 +242,7 @@ rcs_main(int argc, char **argv)
rcsflags |= RCSPROG_LFLAG;
break;
case 'm':
- if (logstr != NULL)
- xfree(logstr);
+ free(logstr);
logstr = xstrdup(rcs_optarg);
break;
case 'M':
@@ -418,8 +417,8 @@ rcs_main(int argc, char **argv)
while (!TAILQ_EMPTY(&(file->rf_access))) {
rap = TAILQ_FIRST(&(file->rf_access));
TAILQ_REMOVE(&(file->rf_access), rap, ra_list);
- xfree(rap->ra_name);
- xfree(rap);
+ free(rap->ra_name);
+ free(rap);
}
/* not synced anymore */
file->rf_flags &= ~RCS_SYNCED;
diff --git a/usr.bin/rcs/rcsutil.c b/usr.bin/rcs/rcsutil.c
index 258e5ed76af..27bac4ff8c4 100644
--- a/usr.bin/rcs/rcsutil.c
+++ b/usr.bin/rcs/rcsutil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsutil.c,v 1.43 2015/01/16 06:40:11 deraadt Exp $ */
+/* $OpenBSD: rcsutil.c,v 1.44 2015/06/13 20:15:21 nicm Exp $ */
/*
* Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -34,6 +34,7 @@
#include <err.h>
#include <fcntl.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -228,7 +229,7 @@ rcs_choosefile(const char *filename, char *out, size_t len)
if (strlcpy(out, rcspath, len) >= len)
errx(1, "rcs_choosefile; truncation");
- xfree(suffixes);
+ free(suffixes);
return (fd);
}
@@ -253,7 +254,7 @@ rcs_choosefile(const char *filename, char *out, size_t len)
if (strlcpy(out, fpath, len) >= len)
errx(1, "rcs_choosefile: truncation");
- xfree(suffixes);
+ free(suffixes);
return (fd);
}
@@ -264,7 +265,7 @@ rcs_choosefile(const char *filename, char *out, size_t len)
if (strlcat(rcspath, suffixes, sizeof(rcspath)) >= sizeof(rcspath))
errx(1, "rcs_choosefile: truncation");
- xfree(suffixes);
+ free(suffixes);
if (strlcpy(out, rcspath, len) >= len)
errx(1, "rcs_choosefile: truncation");
@@ -423,10 +424,8 @@ rcs_rev_select(RCSFILE *file, const char *range)
}
rcs_argv_destroy(revargv);
- if (lnum.rn_id != NULL)
- xfree(lnum.rn_id);
- if (rnum.rn_id != NULL)
- xfree(rnum.rn_id);
+ free(lnum.rn_id);
+ free(rnum.rn_id);
return (nrev);
}
@@ -462,7 +461,7 @@ rcs_set_description(RCSFILE *file, const char *in)
content = rcs_prompt(prompt);
rcs_desc_set(file, content);
- xfree(content);
+ free(content);
return (0);
}
@@ -508,10 +507,10 @@ rcs_freelines(struct rcs_lines *lines)
while ((lp = TAILQ_FIRST(&(lines->l_lines))) != NULL) {
TAILQ_REMOVE(&(lines->l_lines), lp, l_list);
- xfree(lp);
+ free(lp);
}
- xfree(lines);
+ free(lines);
}
BUF *
@@ -608,9 +607,9 @@ rcs_strsplit(const char *str, const char *sep)
void
rcs_argv_destroy(struct rcs_argvector *av)
{
- xfree(av->str);
- xfree(av->argv);
- xfree(av);
+ free(av->str);
+ free(av->argv);
+ free(av);
}
/*
@@ -629,6 +628,6 @@ rcs_strip_suffix(char *filename)
break;
}
}
- xfree(suffixes);
+ free(suffixes);
}
}
diff --git a/usr.bin/rcs/worklist.c b/usr.bin/rcs/worklist.c
index 5a843b236f4..4dd70040f30 100644
--- a/usr.bin/rcs/worklist.c
+++ b/usr.bin/rcs/worklist.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: worklist.c,v 1.3 2010/07/23 08:31:19 ray Exp $ */
+/* $OpenBSD: worklist.c,v 1.4 2015/06/13 20:15:21 nicm Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* All rights reserved.
@@ -28,6 +28,7 @@
#include <err.h>
#include <signal.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -73,7 +74,7 @@ worklist_run(struct wklhead *list, void (*cb)(struct worklist *))
while ((wkl = SLIST_FIRST(list)) != NULL) {
SLIST_REMOVE_HEAD(list, wkl_list);
- xfree(wkl);
+ free(wkl);
}
sigprocmask(SIG_SETMASK, &old, NULL);
diff --git a/usr.bin/rcs/xmalloc.c b/usr.bin/rcs/xmalloc.c
index 0f6524ef386..00f4a464c74 100644
--- a/usr.bin/rcs/xmalloc.c
+++ b/usr.bin/rcs/xmalloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xmalloc.c,v 1.8 2015/03/26 15:17:30 okan Exp $ */
+/* $OpenBSD: xmalloc.c,v 1.9 2015/06/13 20:15:21 nicm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -65,14 +65,6 @@ xreallocarray(void *ptr, size_t nmemb, size_t size)
return new_ptr;
}
-void
-xfree(void *ptr)
-{
- if (ptr == NULL)
- errx(1, "xfree: NULL pointer given as argument");
- free(ptr);
-}
-
char *
xstrdup(const char *str)
{
diff --git a/usr.bin/rcs/xmalloc.h b/usr.bin/rcs/xmalloc.h
index 561e6924b74..ece09be760a 100644
--- a/usr.bin/rcs/xmalloc.h
+++ b/usr.bin/rcs/xmalloc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: xmalloc.h,v 1.2 2014/12/01 21:58:46 deraadt Exp $ */
+/* $OpenBSD: xmalloc.h,v 1.3 2015/06/13 20:15:21 nicm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -22,7 +22,6 @@
void *xmalloc(size_t);
void *xcalloc(size_t, size_t);
void *xreallocarray(void *, size_t, size_t);
-void xfree(void *);
char *xstrdup(const char *);
int xasprintf(char **, const char *, ...)
__attribute__((__format__ (printf, 2, 3)))