]> Cypherpunks repositories - gostls13.git/commitdiff
internal/fuzz: small cleanups
authorKatie Hockman <katie@golang.org>
Tue, 1 Feb 2022 17:30:36 +0000 (12:30 -0500)
committerKatie Hockman <katie@golang.org>
Wed, 2 Feb 2022 16:21:08 +0000 (16:21 +0000)
Change-Id: I9fc12f352d57db776d176990277e104f64f9908d
Reviewed-on: https://go-review.googlesource.com/c/go/+/382238
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Katie Hockman <katie@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/internal/fuzz/fuzz.go
src/internal/fuzz/worker.go

index f2ff3a1390e30d781de074d863217af44fe6849a..0014cde04fb86e1f03bd22174d78625e8adb24ad 100644 (file)
@@ -419,14 +419,14 @@ type corpus struct {
        hashes  map[[sha256.Size]byte]bool
 }
 
-// addCorpusEntries adds entries to the corpus, and optional also writes the entries
+// addCorpusEntries adds entries to the corpus, and optionally writes the entries
 // to the cache directory. If an entry is already in the corpus it is skipped. If
 // all of the entries are unique, addCorpusEntries returns true and a nil error,
 // if at least one of the entries was a duplicate, it returns false and a nil error.
 func (c *coordinator) addCorpusEntries(addToCache bool, entries ...CorpusEntry) (bool, error) {
        noDupes := true
        for _, e := range entries {
-               data, err := CorpusEntryData(e)
+               data, err := corpusEntryData(e)
                if err != nil {
                        return false, err
                }
@@ -478,9 +478,9 @@ type CorpusEntry = struct {
        IsSeed bool
 }
 
-// Data returns the raw input bytes, either from the data struct field,
-// or from disk.
-func CorpusEntryData(ce CorpusEntry) ([]byte, error) {
+// corpusEntryData returns the raw input bytes, either from the data struct
+// field, or from disk.
+func corpusEntryData(ce CorpusEntry) ([]byte, error) {
        if ce.Data != nil {
                return ce.Data, nil
        }
index c2d553240c8383ee52b12ebf9c5d0299b77f6e38..e984ba73b201f0437329daa090117020daae5dc6 100644 (file)
@@ -973,7 +973,7 @@ func (wc *workerClient) minimize(ctx context.Context, entryIn CorpusEntry, args
                return CorpusEntry{}, minimizeResponse{}, errSharedMemClosed
        }
        mem.header().count = 0
-       inp, err := CorpusEntryData(entryIn)
+       inp, err := corpusEntryData(entryIn)
        if err != nil {
                return CorpusEntry{}, minimizeResponse{}, err
        }
@@ -1059,7 +1059,7 @@ func (wc *workerClient) fuzz(ctx context.Context, entryIn CorpusEntry, args fuzz
                return CorpusEntry{}, fuzzResponse{}, true, errSharedMemClosed
        }
        mem.header().count = 0
-       inp, err := CorpusEntryData(entryIn)
+       inp, err := corpusEntryData(entryIn)
        if err != nil {
                return CorpusEntry{}, fuzzResponse{}, true, err
        }