Merge pull request #97 from ikawaha/feature/remove_unsafe_refect_from_compress_nomemcopy
Remove reflect and unsafe from header_compressed_nomemcopy
This commit is contained in:
commit
91db54b040
12
release.go
12
release.go
|
@ -103,9 +103,7 @@ func header_compressed_nomemcopy(w io.Writer) error {
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"reflect"
|
|
||||||
"strings"
|
"strings"
|
||||||
"unsafe"
|
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
@ -114,15 +112,7 @@ func header_compressed_nomemcopy(w io.Writer) error {
|
||||||
)
|
)
|
||||||
|
|
||||||
func bindataRead(data, name string) ([]byte, error) {
|
func bindataRead(data, name string) ([]byte, error) {
|
||||||
var empty [0]byte
|
gz, err := gzip.NewReader(strings.NewReader(data))
|
||||||
sx := (*reflect.StringHeader)(unsafe.Pointer(&data))
|
|
||||||
b := empty[:]
|
|
||||||
bx := (*reflect.SliceHeader)(unsafe.Pointer(&b))
|
|
||||||
bx.Data = sx.Data
|
|
||||||
bx.Len = len(data)
|
|
||||||
bx.Cap = bx.Len
|
|
||||||
|
|
||||||
gz, err := gzip.NewReader(bytes.NewBuffer(b))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("Read %%q: %%v", name, err)
|
return nil, fmt.Errorf("Read %%q: %%v", name, err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user