cmd/internal/ld: delete Biobuf

Update #10652

This proposal deletes cmd/internal/ld.Biobuf and replaces all uses with
cmd/internal/obj.Biobuf. As cmd/internal/ld already imported cmd/internal/obj
there are no additional dependencies created.

Notes:

- ld.Boffset included more checks, so it was merged into obj.Boffset
- obj.Bflush was removed in 8d16253c90, so replaced all calls to
  ld.Bflush, with obj.Biobuf.Flush.
- Almost all of this change was prepared with sed.

Change-Id: I814854d52f5729a5a40c523c8188e465246b88da
Reviewed-on: https://go-review.googlesource.com/9660
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Dave Cheney <dave@cheney.net>
This commit is contained in:
Dave Cheney 2015-05-02 12:44:49 +10:00
parent 5ffdf53b27
commit 71274e4857
16 changed files with 139 additions and 288 deletions

View file

@ -83,12 +83,17 @@ func Bseek(b *Biobuf, offset int64, whence int) int64 {
}
func Boffset(b *Biobuf) int64 {
if err := b.w.Flush(); err != nil {
log.Fatalf("writing output: %v", err)
if b.w != nil {
if err := b.w.Flush(); err != nil {
log.Fatalf("writing output: %v", err)
}
}
off, err := b.f.Seek(0, 1)
if err != nil {
log.Fatalf("seeking in output: %v", err)
log.Fatalf("seeking in output [0, 1]: %v", err)
}
if b.r != nil {
off -= int64(b.r.Buffered())
}
return off
}