From 32641bbf935a44597c50d285beacb812f18d9075 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 85e89686e..b6104e0e5 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -416,8 +416,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 {