summaryrefslogtreecommitdiff
path: root/usr.bin/rcs/rcs.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/rcs/rcs.c')
-rw-r--r--usr.bin/rcs/rcs.c57
1 files changed, 29 insertions, 28 deletions
diff --git a/usr.bin/rcs/rcs.c b/usr.bin/rcs/rcs.c
index e8d034972ac..94870dffc19 100644
--- a/usr.bin/rcs/rcs.c
+++ b/usr.bin/rcs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.58 2010/07/23 08:31:19 ray Exp $ */
+/* $OpenBSD: rcs.c,v 1.59 2010/07/23 21:46:05 ray Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -1145,7 +1145,7 @@ rcs_patch_lines(struct rcs_lines *dlines, struct rcs_lines *plines)
*
* Get the whole contents of revision <rev> from the RCSFILE <rfp>. The
* returned buffer is dynamically allocated and should be released using
- * rcs_buf_free() once the caller is done using it.
+ * buf_free() once the caller is done using it.
*/
BUF*
rcs_getrev(RCSFILE *rfp, RCSNUM *frev)
@@ -1190,13 +1190,13 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *frev)
len = rdp->rd_tlen;
if (len == 0) {
- rbuf = rcs_buf_alloc(1, 0);
- rcs_buf_empty(rbuf);
+ rbuf = buf_alloc(1, 0);
+ buf_empty(rbuf);
return (rbuf);
}
- rbuf = rcs_buf_alloc(len, BUF_AUTOEXT);
- rcs_buf_append(rbuf, rdp->rd_text, len);
+ rbuf = buf_alloc(len, BUF_AUTOEXT);
+ buf_append(rbuf, rdp->rd_text, len);
isbranch = 0;
brev = NULL;
@@ -1261,14 +1261,14 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *frev)
rdp = rcs_findrev(rfp, crev);
if (rdp == NULL) {
- rcs_buf_free(rbuf);
+ buf_free(rbuf);
return (NULL);
}
plen = rdp->rd_tlen;
- dlen = rcs_buf_len(rbuf);
+ dlen = buf_len(rbuf);
patch = rdp->rd_text;
- data = rcs_buf_release(rbuf);
+ data = buf_release(rbuf);
/* check if we have parsed this rev's deltatext */
if (rdp->rd_tlen == 0)
rcs_parse_deltatexts(rfp, rdp->rd_num);
@@ -1455,16 +1455,16 @@ rcs_rev_remove(RCSFILE *rf, RCSNUM *rev)
if ((nextbuf = rcs_getrev(rf, nextrdp->rd_num)) == NULL)
errx(1, "error getting revision");
- newdiff = rcs_buf_alloc(64, BUF_AUTOEXT);
+ newdiff = buf_alloc(64, BUF_AUTOEXT);
/* calculate new diff */
(void)xasprintf(&path_tmp1, "%s/diff1.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(nextbuf, path_tmp1);
- rcs_buf_free(nextbuf);
+ buf_write_stmp(nextbuf, path_tmp1);
+ buf_free(nextbuf);
(void)xasprintf(&path_tmp2, "%s/diff2.XXXXXXXXXX", rcs_tmpdir);
- rcs_buf_write_stmp(prevbuf, path_tmp2);
- rcs_buf_free(prevbuf);
+ buf_write_stmp(prevbuf, path_tmp2);
+ buf_free(prevbuf);
diff_format = D_RCSDIFF;
if (diffreg(path_tmp1, path_tmp2, newdiff, D_FORCEASCII) == D_ERROR)
@@ -2662,9 +2662,9 @@ rcs_expand_keywords(char *rcsfile, struct rcs_delta *rdp, BUF *bp, int mode)
if (timezone_flag != NULL)
rcs_set_tz(timezone_flag, rdp, &tb);
- len = rcs_buf_len(bp);
+ len = buf_len(bp);
- c = rcs_buf_get(bp);
+ c = buf_get(bp);
found = 0;
/* Final character in buffer. */
fin = c + len - 1;
@@ -2832,25 +2832,25 @@ rcs_expand_keywords(char *rcsfile, struct rcs_delta *rdp, BUF *bp, int mode)
errx(1, "rcs_expand_keywords: string truncated");
/* Concatenate everything together. */
- tmpbuf = rcs_buf_alloc(len + strlen(expbuf), BUF_AUTOEXT);
+ tmpbuf = buf_alloc(len + strlen(expbuf), BUF_AUTOEXT);
/* Append everything before keyword. */
- rcs_buf_append(tmpbuf, rcs_buf_get(newbuf),
- start - (unsigned char *)rcs_buf_get(newbuf));
+ buf_append(tmpbuf, buf_get(newbuf),
+ start - (unsigned char *)buf_get(newbuf));
/* Append keyword. */
- rcs_buf_append(tmpbuf, expbuf, strlen(expbuf));
+ buf_append(tmpbuf, expbuf, strlen(expbuf));
/* Point c to end of keyword. */
- c = rcs_buf_get(tmpbuf) + rcs_buf_len(tmpbuf) - 1;
+ c = buf_get(tmpbuf) + buf_len(tmpbuf) - 1;
/* Append everything after keyword. */
- rcs_buf_append(tmpbuf, end,
- ((unsigned char *)rcs_buf_get(newbuf) + rcs_buf_len(newbuf)) - end);
+ buf_append(tmpbuf, end,
+ ((unsigned char *)buf_get(newbuf) + buf_len(newbuf)) - end);
/* Point fin to end of data. */
- fin = rcs_buf_get(tmpbuf) + rcs_buf_len(tmpbuf) - 1;
+ fin = buf_get(tmpbuf) + buf_len(tmpbuf) - 1;
/* Recalculate new length. */
- len = rcs_buf_len(tmpbuf);
+ len = buf_len(tmpbuf);
/* tmpbuf is now ready, free old newbuf if allocated here. */
if (newbuf != bp)
- rcs_buf_free(newbuf);
+ buf_free(newbuf);
newbuf = tmpbuf;
}
}
@@ -2880,9 +2880,10 @@ rcs_deltatext_set(RCSFILE *rfp, RCSNUM *rev, BUF *bp)
if (rdp->rd_text != NULL)
xfree(rdp->rd_text);
- len = rcs_buf_len(bp);
- dtext = rcs_buf_release(bp);
+ len = buf_len(bp);
+ dtext = buf_release(bp);
bp = NULL;
+
if (len != 0) {
rdp->rd_text = xmalloc(len);
rdp->rd_tlen = len;