From c79bc6c59dcdcbcb253e184d2b2a9e04e75b08a0 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Tue, 1 Dec 2015 23:11:24 +0100 Subject: [PATCH] Refactorization: Call std::string::find_first_of() only once. --- lib/preprocessor.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index 480abfe18..ec082be5d 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -1444,8 +1444,9 @@ std::list Preprocessor::getcfgs(const std::string &filedata, const // Get name of define std::string defineName(*it2); - if (defineName.find_first_of("=(") != std::string::npos) - defineName.erase(defineName.find_first_of("=(")); + std::string::size_type end = defineName.find_first_of("=("); + if (end != std::string::npos) + defineName.erase(end); // Remove ifdef configurations that match the defineName while ((pos = cfg.find(defineName, pos)) != std::string::npos) {