Skip to content

Commit

Permalink
Use Named Fields and Align Structures to Reduce Memory Usage (#1814)
Browse files Browse the repository at this point in the history
* Use Named fields and Align Structures to Reduce Memory Usage

* Remove extra spaces
  • Loading branch information
gaby authored Aug 2, 2024
1 parent bb0c8dd commit 1fb3453
Show file tree
Hide file tree
Showing 29 changed files with 478 additions and 445 deletions.
6 changes: 3 additions & 3 deletions brotli.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ var (
// - CompressBrotliBestCompression
// - CompressBrotliDefaultCompression
func AppendBrotliBytesLevel(dst, src []byte, level int) []byte {
w := &byteSliceWriter{dst}
w := &byteSliceWriter{b: dst}
WriteBrotliLevel(w, src, level) //nolint:errcheck
return w.b
}
Expand Down Expand Up @@ -167,7 +167,7 @@ func AppendBrotliBytes(dst, src []byte) []byte {
// WriteUnbrotli writes unbrotlied p to w and returns the number of uncompressed
// bytes written to w.
func WriteUnbrotli(w io.Writer, p []byte) (int, error) {
r := &byteSliceReader{p}
r := &byteSliceReader{b: p}
zr, err := acquireBrotliReader(r)
if err != nil {
return 0, err
Expand All @@ -183,7 +183,7 @@ func WriteUnbrotli(w io.Writer, p []byte) (int, error) {

// AppendUnbrotliBytes appends unbrotlied src to dst and returns the resulting dst.
func AppendUnbrotliBytes(dst, src []byte) ([]byte, error) {
w := &byteSliceWriter{dst}
w := &byteSliceWriter{b: dst}
_, err := WriteUnbrotli(w, src)
return w.b, err
}
Expand Down
Loading

0 comments on commit 1fb3453

Please sign in to comment.