Skip to content

Commit 8dce385

Browse files
committed
fix: resolve -Wfree-nonheap-object warnings with gcc15
Change substrs to std::string_view and fix the find comparison logic
1 parent ef03580 commit 8dce385

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/llama-vocab.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2060,9 +2060,9 @@ void llama_vocab::impl::load(llama_model_loader & ml, const LLM_KV & kv) {
20602060
//NOTE: Per token attributes are missing from the GGUF file.
20612061
//TODO: Extract attributes from GGUF file.
20622062
{
2063-
auto _contains_any = [] (const std::string & str, const std::vector<std::string> & substrs) -> bool {
2063+
auto _contains_any = [] (const std::string & str, const std::vector<std::string_view> & substrs) -> bool {
20642064
for (const auto & substr : substrs) {
2065-
if (str.find(substr) < std::string::npos) {
2065+
if (str.find(substr) != std::string::npos) {
20662066
return true;
20672067
}
20682068
}

0 commit comments

Comments
 (0)