Cosmetic fixes.

This commit is contained in:
jim teeuwen 2012-06-14 11:20:10 +02:00
parent 37af2a4b27
commit c2d800d607

View File

@ -50,13 +50,16 @@ func %s() []byte {`, funcname, funcname)
if uncompressed { if uncompressed {
fmt.Fprintf(output, ` fmt.Fprintf(output, `
// This bit of black magic ensures we do not get
// unneccesary memcpy's and can read directly from
// the .rodata section.
var empty [0]byte var empty [0]byte
sx := (*reflect.StringHeader)(unsafe.Pointer(&_%s)) sx := (*reflect.StringHeader)(unsafe.Pointer(&_%s))
b := empty[:] b := empty[:]
bx := (*reflect.SliceHeader)(unsafe.Pointer(&b)) bx := (*reflect.SliceHeader)(unsafe.Pointer(&b))
bx.Data = sx.Data bx.Data = sx.Data
bx.Len = len(_%s) bx.Len = len(_%s)
bx.Cap = bx.Len bx.Cap = bx.Len
return b`, funcname, funcname) return b`, funcname, funcname)
} else { } else {
fmt.Fprintf(output, ` fmt.Fprintf(output, `
@ -68,8 +71,8 @@ func %s() []byte {`, funcname, funcname)
b := empty[:] b := empty[:]
bx := (*reflect.SliceHeader)(unsafe.Pointer(&b)) bx := (*reflect.SliceHeader)(unsafe.Pointer(&b))
bx.Data = sx.Data bx.Data = sx.Data
bx.Len = len(_%s) bx.Len = len(_%s)
bx.Cap = bx.Len bx.Cap = bx.Len
gz, err := gzip.NewReader(bytes.NewBuffer(b)) gz, err := gzip.NewReader(bytes.NewBuffer(b))