diff options
author | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2010-09-08 15:13:40 +0000 |
---|---|---|
committer | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2010-09-08 15:13:40 +0000 |
commit | dcfac19c137f5f64521068c172324430a8cf2e03 (patch) | |
tree | 1be323af11f93f4b5b53854bf2f6253635248bde /usr.bin/cvs | |
parent | 397e041cfa8279dc7b768aa647e2c2a905d0cede (diff) |
Use SIZE_LEFT macro to determine left size instead of calculating with
pointers.
ok zinovik
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r-- | usr.bin/cvs/buf.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/usr.bin/cvs/buf.c b/usr.bin/cvs/buf.c index 9102a5dcab4..c54260be977 100644 --- a/usr.bin/cvs/buf.c +++ b/usr.bin/cvs/buf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buf.c,v 1.78 2010/08/01 09:19:29 zinovik Exp $ */ +/* $OpenBSD: buf.c,v 1.79 2010/09/08 15:13:39 tobias Exp $ */ /* * Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -127,11 +127,9 @@ buf_putc(BUF *b, int c) { u_char *bp; - bp = b->cb_buf + b->cb_len; - if (bp == (b->cb_buf + b->cb_size)) { + if (SIZE_LEFT(b) == 0) buf_grow(b, BUF_INCR); - bp = b->cb_buf + b->cb_len; - } + bp = b->cb_buf + b->cb_len; *bp = (u_char)c; b->cb_len++; } |