diff options
author | Russ Cox <rsc@golang.org> | 2008-10-20 17:33:51 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2008-10-20 17:33:51 -0700 |
commit | 2a684c990a6ec2a9b01d964ff7e904afeafa8c0d (patch) | |
tree | daeb13aa7a7dcb2f4757560bcdaa444c6fb21981 /src/libbio | |
parent | 7e5d65776534dcef0fedeb6f947fea6bcc691879 (diff) | |
download | golang-2a684c990a6ec2a9b01d964ff7e904afeafa8c0d.tar.gz |
6l:
use libbio instead of maintaining own buffer
libbio:
always use vlong offsets; die if off_t is too small
R=r
DELTA=163 (23 added, 63 deleted, 77 changed)
OCL=17508
CL=17512
Diffstat (limited to 'src/libbio')
-rw-r--r-- | src/libbio/boffset.c | 7 | ||||
-rw-r--r-- | src/libbio/bseek.c | 12 |
2 files changed, 13 insertions, 6 deletions
diff --git a/src/libbio/boffset.c b/src/libbio/boffset.c index 77d8b08fa..15dd609e1 100644 --- a/src/libbio/boffset.c +++ b/src/libbio/boffset.c @@ -23,13 +23,14 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "lib9.h" +#include <u.h> +#include <libc.h> #include <bio.h> -off_t +vlong Boffset(Biobuf *bp) { - off_t n; + vlong n; switch(bp->state) { default: diff --git a/src/libbio/bseek.c b/src/libbio/bseek.c index d60aeebc4..ee3ba7714 100644 --- a/src/libbio/bseek.c +++ b/src/libbio/bseek.c @@ -23,15 +23,21 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "lib9.h" +#include <u.h> +#include <libc.h> #include <bio.h> -off_t -Bseek(Biobuf *bp, off_t offset, int base) +vlong +Bseek(Biobuf *bp, vlong offset, int base) { vlong n, d; int bufsz; + if(sizeof(offset) != sizeof(off_t)) { + fprint(2, "Bseek: libbio compiled with %d-byte offset\n", sizeof(off_t)); + abort(); + } + switch(bp->state) { default: fprint(2, "Bseek: unknown state %d\n", bp->state); |