summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Santolaria <xsa@cvs.openbsd.org>2006-04-06 16:48:35 +0000
committerXavier Santolaria <xsa@cvs.openbsd.org>2006-04-06 16:48:35 +0000
commiteb4f43e6bac8c9bc330e71b4724268af90d2439c (patch)
treec77a847e4dbcdebf5a4dcb6fea4d72239cac2ca7
parentb869e72cc91c2b372957ad498e6d39d88aecbedb (diff)
cvs_buf_copy() and cvs_buf_peek() are not used by usr.bin/rcs; OK niallo@.
-rw-r--r--usr.bin/cvs/buf.c74
-rw-r--r--usr.bin/cvs/buf.h8
2 files changed, 43 insertions, 39 deletions
diff --git a/usr.bin/cvs/buf.c b/usr.bin/cvs/buf.c
index f331d5e312c..4a284229d38 100644
--- a/usr.bin/cvs/buf.c
+++ b/usr.bin/cvs/buf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buf.c,v 1.42 2006/04/05 01:38:55 ray Exp $ */
+/* $OpenBSD: buf.c,v 1.43 2006/04/06 16:48:34 xsa Exp $ */
/*
* Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -164,27 +164,6 @@ cvs_buf_empty(BUF *b)
}
/*
- * cvs_buf_copy()
- *
- * Copy the first <len> bytes of data in the buffer <b> starting at offset
- * <off> in the destination buffer <dst>, which can accept up to <len> bytes.
- * Returns the number of bytes successfully copied, or -1 on failure.
- */
-ssize_t
-cvs_buf_copy(BUF *b, size_t off, void *dst, size_t len)
-{
- size_t rc;
-
- if (off > b->cb_len)
- fatal("cvs_buf_copy failed");
-
- rc = MIN(len, (b->cb_len - off));
- memcpy(dst, b->cb_buf + off, rc);
-
- return (ssize_t)rc;
-}
-
-/*
* cvs_buf_set()
*
* Set the contents of the buffer <b> at offset <off> to the first <len>
@@ -321,20 +300,6 @@ cvs_buf_len(BUF *b)
}
/*
- * cvs_buf_peek()
- *
- * Peek at the contents of the buffer <b> at offset <off>.
- */
-const void *
-cvs_buf_peek(BUF *b, size_t off)
-{
- if (off >= b->cb_len)
- return (NULL);
-
- return (b->cb_buf + off);
-}
-
-/*
* cvs_buf_write_fd()
*
* Write the contents of the buffer <b> to the specified <fd>
@@ -444,3 +409,40 @@ cvs_buf_grow(BUF *b, size_t len)
return (ssize_t)b->cb_size;
}
+
+#if !defined(RCSPROG)
+/*
+ * cvs_buf_copy()
+ *
+ * Copy the first <len> bytes of data in the buffer <b> starting at offset
+ * <off> in the destination buffer <dst>, which can accept up to <len> bytes.
+ * Returns the number of bytes successfully copied, or -1 on failure.
+ */
+ssize_t
+cvs_buf_copy(BUF *b, size_t off, void *dst, size_t len)
+{
+ size_t rc;
+
+ if (off > b->cb_len)
+ fatal("cvs_buf_copy failed");
+
+ rc = MIN(len, (b->cb_len - off));
+ memcpy(dst, b->cb_buf + off, rc);
+
+ return (ssize_t)rc;
+}
+
+/*
+ * cvs_buf_peek()
+ *
+ * Peek at the contents of the buffer <b> at offset <off>.
+ */
+const void *
+cvs_buf_peek(BUF *b, size_t off)
+{
+ if (off >= b->cb_len)
+ return (NULL);
+
+ return (b->cb_buf + off);
+}
+#endif /* RCSPROG */
diff --git a/usr.bin/cvs/buf.h b/usr.bin/cvs/buf.h
index 78fed232823..f354e0864bd 100644
--- a/usr.bin/cvs/buf.h
+++ b/usr.bin/cvs/buf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: buf.h,v 1.13 2006/03/25 21:29:59 ray Exp $ */
+/* $OpenBSD: buf.h,v 1.14 2006/04/06 16:48:34 xsa Exp $ */
/*
* Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -51,17 +51,19 @@ void cvs_buf_free(BUF *);
void *cvs_buf_release(BUF *);
u_char cvs_buf_getc(BUF *, size_t);
void cvs_buf_empty(BUF *);
-ssize_t cvs_buf_copy(BUF *, size_t, void *, size_t);
ssize_t cvs_buf_set(BUF *, const void *, size_t, size_t);
ssize_t cvs_buf_append(BUF *, const void *, size_t);
ssize_t cvs_buf_fappend(BUF *, const char *, ...)
__attribute__((format(printf, 2, 3)));
void cvs_buf_putc(BUF *, int);
size_t cvs_buf_len(BUF *);
-const void *cvs_buf_peek(BUF *, size_t);
int cvs_buf_write_fd(BUF *, int);
int cvs_buf_write(BUF *, const char *, mode_t);
void cvs_buf_write_stmp(BUF *, char *, mode_t);
+#if !defined(RCSPROG)
+ssize_t cvs_buf_copy(BUF *, size_t, void *, size_t);
+const void *cvs_buf_peek(BUF *, size_t);
+#endif /* RCSPROG */
#define cvs_buf_get(b) cvs_buf_peek(b, 0)