diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2025-01-17 10:28:16 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2025-01-17 10:02:07 +0000 |
| commit | 5d04aae8969f6c72318ce0a4cde4f027766b1a55 (patch) | |
| tree | 8f1b632847c431407090f0fe1335522ff2195a37 /syz-hub | |
| parent | f9e07a6e597b68d3397864e6ee4550f9065c3518 (diff) | |
all: use min/max functions
They are shorter, more readable, and don't require temp vars.
Diffstat (limited to 'syz-hub')
| -rw-r--r-- | syz-hub/state/state.go | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/syz-hub/state/state.go b/syz-hub/state/state.go index 4d25c20a3..0bed36a91 100644 --- a/syz-hub/state/state.go +++ b/syz-hub/state/state.go @@ -134,9 +134,7 @@ func loadDB(file, name string, progs bool) (*db.DB, uint64, error) { continue } } - if maxSeq < rec.Seq { - maxSeq = rec.Seq - } + maxSeq = max(maxSeq, rec.Seq) } if err := db.Flush(); err != nil { return nil, 0, fmt.Errorf("failed to flush corpus database: %w", err) @@ -157,16 +155,12 @@ func (st *State) createManager(name string) (*Manager, error) { ownRepros: make(map[string]bool), } mgr.corpusSeq = loadSeqFile(mgr.corpusSeqFile) - if st.corpusSeq < mgr.corpusSeq { - st.corpusSeq = mgr.corpusSeq - } + st.corpusSeq = max(st.corpusSeq, mgr.corpusSeq) mgr.reproSeq = loadSeqFile(mgr.reproSeqFile) if mgr.reproSeq == 0 { mgr.reproSeq = st.reproSeq } - if st.reproSeq < mgr.reproSeq { - st.reproSeq = mgr.reproSeq - } + st.reproSeq = max(st.reproSeq, mgr.reproSeq) domainData, _ := os.ReadFile(mgr.domainFile) mgr.Domain = string(domainData) corpus, _, err := loadDB(mgr.corpusFile, name, false) |
