Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Named Fields and Align Structures to Reduce Memory Usage #1814

Merged
merged 3 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading