summaryrefslogtreecommitdiff
path: root/usr.bin/rcs
diff options
context:
space:
mode:
authorNiall O'Higgins <niallo@cvs.openbsd.org>2007-01-11 18:13:34 +0000
committerNiall O'Higgins <niallo@cvs.openbsd.org>2007-01-11 18:13:34 +0000
commit5d1a7dc92d6d88c1edd14b4ba858d5c9c87647e0 (patch)
tree50db094a911f745d51f1eee8efe88a419c4805a6 /usr.bin/rcs
parent1b484e361542f19a7857ae81bc7dd11be82444e4 (diff)
remove some un-needed buffer NUL-termination. in openrcs, diff3 is already NUL-terminating its
buffers so we don't need to do it twice. this allows us to sync rcs_splitlines() with opencvs' cvs_splitlines(). ok joris@
Diffstat (limited to 'usr.bin/rcs')
-rw-r--r--usr.bin/rcs/diff3.c11
-rw-r--r--usr.bin/rcs/rcsutil.c6
2 files changed, 4 insertions, 13 deletions
diff --git a/usr.bin/rcs/diff3.c b/usr.bin/rcs/diff3.c
index ee40c32d81a..bf8ce3b7dea 100644
--- a/usr.bin/rcs/diff3.c
+++ b/usr.bin/rcs/diff3.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff3.c,v 1.17 2007/01/02 16:43:45 niallo Exp $ */
+/* $OpenBSD: diff3.c,v 1.18 2007/01/11 18:13:33 niallo Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
@@ -72,7 +72,7 @@ static const char copyright[] =
#ifndef lint
static const char rcsid[] =
- "$OpenBSD: diff3.c,v 1.17 2007/01/02 16:43:45 niallo Exp $";
+ "$OpenBSD: diff3.c,v 1.18 2007/01/11 18:13:33 niallo Exp $";
#endif /* not lint */
#include "includes.h"
@@ -228,10 +228,6 @@ merge_diff3(char **av, int flags)
goto out;
}
- rcs_buf_putc(diffb, '\0');
- rcs_buf_putc(b1, '\0');
-
-
plen = rcs_buf_len(diffb);
patch = rcs_buf_release(diffb);
dlen = rcs_buf_len(b1);
@@ -359,9 +355,6 @@ rcs_diff3(RCSFILE *rf, char *workfile, RCSNUM *rev1, RCSNUM *rev2, int flags)
goto out;
}
- rcs_buf_putc(diffb, '\0');
- rcs_buf_putc(b1, '\0');
-
plen = rcs_buf_len(diffb);
patch = rcs_buf_release(diffb);
dlen = rcs_buf_len(b1);
diff --git a/usr.bin/rcs/rcsutil.c b/usr.bin/rcs/rcsutil.c
index e9b7218570a..9210f4ed872 100644
--- a/usr.bin/rcs/rcsutil.c
+++ b/usr.bin/rcs/rcsutil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsutil.c,v 1.25 2007/01/10 02:13:23 ray Exp $ */
+/* $OpenBSD: rcsutil.c,v 1.26 2007/01/11 18:13:33 niallo Exp $ */
/*
* Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -492,9 +492,7 @@ rcs_splitlines(const u_char *data, size_t len)
p = c = data;
for (i = 0; i < len; i++) {
if (*p == '\n' || (i == len - 1)) {
- tlen = p - c;
- if (*p == '\n')
- tlen++;
+ tlen = p - c + 1;
lp = xmalloc(sizeof(*lp));
lp->l_line = c;
lp->l_len = tlen;