From b97a9a1398951274305260edf5513f40f820ff89 Mon Sep 17 00:00:00 2001 From: Dominik Maier Date: Thu, 23 May 2024 15:44:32 +0200 Subject: [PATCH] Rename peek_next_free_id to peek_free_id (that it's the next is obvious) (#2243) --- libafl/src/corpus/cached.rs | 4 ++-- libafl/src/corpus/inmemory.rs | 6 +++--- libafl/src/corpus/inmemory_ondisk.rs | 4 ++-- libafl/src/corpus/mod.rs | 2 +- libafl/src/corpus/nop.rs | 2 +- libafl/src/corpus/ondisk.rs | 4 ++-- libafl_libfuzzer/libafl_libfuzzer_runtime/src/corpus.rs | 6 +++--- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/libafl/src/corpus/cached.rs b/libafl/src/corpus/cached.rs index c38edaf007..c3fbee79d4 100644 --- a/libafl/src/corpus/cached.rs +++ b/libafl/src/corpus/cached.rs @@ -149,8 +149,8 @@ where /// Peek the next free corpus id #[inline] - fn peek_next_free_id(&self) -> CorpusId { - self.inner.peek_next_free_id() + fn peek_free_id(&self) -> CorpusId { + self.inner.peek_free_id() } #[inline] diff --git a/libafl/src/corpus/inmemory.rs b/libafl/src/corpus/inmemory.rs index 0e6169614c..88e4abd187 100644 --- a/libafl/src/corpus/inmemory.rs +++ b/libafl/src/corpus/inmemory.rs @@ -266,7 +266,7 @@ where #[must_use] /// Peek the next free corpus id - pub fn peek_next_free_id(&self) -> CorpusId { + pub fn peek_free_id(&self) -> CorpusId { CorpusId::from(self.progressive_idx) } @@ -438,8 +438,8 @@ where /// Peek the next free corpus id #[inline] - fn peek_next_free_id(&self) -> CorpusId { - self.storage.peek_next_free_id() + fn peek_free_id(&self) -> CorpusId { + self.storage.peek_free_id() } #[inline] diff --git a/libafl/src/corpus/inmemory_ondisk.rs b/libafl/src/corpus/inmemory_ondisk.rs index f77f376d5c..f9bcebd942 100644 --- a/libafl/src/corpus/inmemory_ondisk.rs +++ b/libafl/src/corpus/inmemory_ondisk.rs @@ -151,8 +151,8 @@ where /// Peek the next free corpus id #[inline] - fn peek_next_free_id(&self) -> CorpusId { - self.inner.peek_next_free_id() + fn peek_free_id(&self) -> CorpusId { + self.inner.peek_free_id() } #[inline] diff --git a/libafl/src/corpus/mod.rs b/libafl/src/corpus/mod.rs index 80ef4e427c..63e1a67ba7 100644 --- a/libafl/src/corpus/mod.rs +++ b/libafl/src/corpus/mod.rs @@ -132,7 +132,7 @@ pub trait Corpus: UsesInput + Serialize + for<'de> Deserialize<'de> { fn next(&self, id: CorpusId) -> Option; /// Peek the next free corpus id - fn peek_next_free_id(&self) -> CorpusId; + fn peek_free_id(&self) -> CorpusId; /// Get the prev corpus id fn prev(&self, id: CorpusId) -> Option; diff --git a/libafl/src/corpus/nop.rs b/libafl/src/corpus/nop.rs index afec997bdc..cf0437c043 100644 --- a/libafl/src/corpus/nop.rs +++ b/libafl/src/corpus/nop.rs @@ -89,7 +89,7 @@ where /// Peek the next free corpus id #[inline] - fn peek_next_free_id(&self) -> CorpusId { + fn peek_free_id(&self) -> CorpusId { CorpusId::from(0_usize) } diff --git a/libafl/src/corpus/ondisk.rs b/libafl/src/corpus/ondisk.rs index 0b8e878eb1..4f8512e9c5 100644 --- a/libafl/src/corpus/ondisk.rs +++ b/libafl/src/corpus/ondisk.rs @@ -108,8 +108,8 @@ where /// Peek the next free corpus id #[inline] - fn peek_next_free_id(&self) -> CorpusId { - self.inner.peek_next_free_id() + fn peek_free_id(&self) -> CorpusId { + self.inner.peek_free_id() } /// Removes an entry from the corpus, returning it if it was present. diff --git a/libafl_libfuzzer/libafl_libfuzzer_runtime/src/corpus.rs b/libafl_libfuzzer/libafl_libfuzzer_runtime/src/corpus.rs index 0a3665046f..3a287b4d9b 100644 --- a/libafl_libfuzzer/libafl_libfuzzer_runtime/src/corpus.rs +++ b/libafl_libfuzzer/libafl_libfuzzer_runtime/src/corpus.rs @@ -203,8 +203,8 @@ where fn next(&self, id: CorpusId) -> Option { self.mapping.enabled.next(id) } - fn peek_next_free_id(&self) -> CorpusId { - self.mapping.peek_next_free_id() + fn peek_free_id(&self) -> CorpusId { + self.mapping.peek_free_id() } fn prev(&self, id: CorpusId) -> Option { @@ -359,7 +359,7 @@ where maybe_last.ok_or_else(|| Error::illegal_argument("Can only get the last corpus ID.")) } - fn peek_next_free_id(&self) -> CorpusId { + fn peek_free_id(&self) -> CorpusId { CorpusId::from(self.count) }