diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-03-17 17:25:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-17 17:25:21 +0100 |
commit | 8f1ce4bddd54fe8067cca688430a7099c5f42cd1 (patch) | |
tree | 1c6f2e629375a9ab1532d769440f183f50c33dcc /vendor/github.com/klauspost/compress/zstd/encoder.go | |
parent | 9ef5d28759e6d37c6f5c1f07df4cf676077851dc (diff) | |
parent | 8081d9c74552612ad73fef27e5775fcfb371e812 (diff) | |
download | podman-8f1ce4bddd54fe8067cca688430a7099c5f42cd1.tar.gz podman-8f1ce4bddd54fe8067cca688430a7099c5f42cd1.tar.bz2 podman-8f1ce4bddd54fe8067cca688430a7099c5f42cd1.zip |
Merge pull request #5524 from rhatdan/vendor
Update containers/storage to v1.16.5
Diffstat (limited to 'vendor/github.com/klauspost/compress/zstd/encoder.go')
-rw-r--r-- | vendor/github.com/klauspost/compress/zstd/encoder.go | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/vendor/github.com/klauspost/compress/zstd/encoder.go b/vendor/github.com/klauspost/compress/zstd/encoder.go index 4032fb9fc..67d45efb9 100644 --- a/vendor/github.com/klauspost/compress/zstd/encoder.go +++ b/vendor/github.com/klauspost/compress/zstd/encoder.go @@ -71,15 +71,14 @@ func NewWriter(w io.Writer, opts ...EOption) (*Encoder, error) { } if w != nil { e.Reset(w) - } else { - e.init.Do(func() { - e.initialize() - }) } return &e, nil } func (e *Encoder) initialize() { + if e.o.concurrent == 0 { + e.o.setDefault() + } e.encoders = make(chan encoder, e.o.concurrent) for i := 0; i < e.o.concurrent; i++ { e.encoders <- e.o.encoder() @@ -89,9 +88,6 @@ func (e *Encoder) initialize() { // Reset will re-initialize the writer and new writes will encode to the supplied writer // as a new, independent stream. func (e *Encoder) Reset(w io.Writer) { - e.init.Do(func() { - e.initialize() - }) s := &e.state s.wg.Wait() s.wWg.Wait() @@ -422,10 +418,7 @@ func (e *Encoder) EncodeAll(src, dst []byte) []byte { } return dst } - e.init.Do(func() { - e.o.setDefault() - e.initialize() - }) + e.init.Do(e.initialize) enc := <-e.encoders defer func() { // Release encoder reference to last block. |