From 5d04aae8969f6c72318ce0a4cde4f027766b1a55 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 17 Jan 2025 10:28:16 +0100 Subject: all: use min/max functions They are shorter, more readable, and don't require temp vars. --- syz-hub/state/state.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'syz-hub') 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) -- cgit mrf-deployment