diff options
author | Xavier Santolaria <xsa@cvs.openbsd.org> | 2006-04-06 16:48:35 +0000 |
---|---|---|
committer | Xavier Santolaria <xsa@cvs.openbsd.org> | 2006-04-06 16:48:35 +0000 |
commit | eb4f43e6bac8c9bc330e71b4724268af90d2439c (patch) | |
tree | c77a847e4dbcdebf5a4dcb6fea4d72239cac2ca7 /usr.bin/cvs/buf.c | |
parent | b869e72cc91c2b372957ad498e6d39d88aecbedb (diff) |
cvs_buf_copy() and cvs_buf_peek() are not used by usr.bin/rcs; OK niallo@.
Diffstat (limited to 'usr.bin/cvs/buf.c')
-rw-r--r-- | usr.bin/cvs/buf.c | 74 |
1 files changed, 38 insertions, 36 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 */ |