From ae219cb8f9b9d3a023599ce4a6c3632276b26016 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Thu, 16 Oct 2025 04:05:56 +0000 Subject: [PATCH] Make IdString::contains take std::string_view so we avoid a strlen when the parameter is a string constant --- kernel/rtlil.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/rtlil.h b/kernel/rtlil.h index 6992b45cf..b65b9b6eb 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -415,8 +415,8 @@ struct RTLIL::IdString return compare(sz - suffix.size(), suffix.size(), suffix.data()) == 0; } - bool contains(const char* str) const { - return strstr(c_str(), str); + bool contains(std::string_view s) const { + return std::string_view(c_str()).find(s) != std::string::npos; } size_t size() const {