Update to gobook@27cf7b490526a0a0751ff12ed7cc4acd8afa2edc

This commit is contained in:
Alan Donovan
2015-12-06 11:23:30 -05:00
parent 34cd1719c0
commit b7e11892d0
4 changed files with 33 additions and 28 deletions
+9 -6
View File
@@ -2,6 +2,14 @@
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
// See page 362.
//
// The version of this program that appeared in the first and second
// printings did not comply with the proposed rules for passing
// pointers between Go and C, described here:
// https://github.com/golang/proposal/blob/master/design/12416-cgo-pointers.md
//
// The version below, which appears in the third printing,
// has been corrected. See bzip2.go for explanation.
//!+
/* This file is gopl.io/ch13/bzip/bzip2.c, */
@@ -17,12 +25,7 @@ int bz2compress(bz_stream *s, int action,
int r = BZ2_bzCompress(s, action);
*inlen -= s->avail_in;
*outlen -= s->avail_out;
/* "C code may store a Go pointer in C memory subject to rule 2:
* it must stop storing the pointer before it returns to Go." */
s->next_in = NULL;
s->next_out = NULL;
s->next_in = s->next_out = NULL;
return r;
}