From a3951ae345018505e473b7ef95f092f54b668a33 Mon Sep 17 00:00:00 2001 From: Twan van Laarhoven Date: Tue, 12 May 2020 02:10:38 +0200 Subject: [PATCH] Use iterators instead of Char* --- src/util/string.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/util/string.cpp b/src/util/string.cpp index a5bb85b5..8071dda8 100644 --- a/src/util/string.cpp +++ b/src/util/string.cpp @@ -418,12 +418,12 @@ bool is_substr_i(const String& str, size_t pos, const String& cmp) { bool canonical_name_compare(const String& as, const Char* b) { assert(canonical_name_form(b) == b); - const Char* a = as.c_str(); - while (true) { - if (*a != *b && !(*a == _('_') && *b == _(' '))) return false; - if (*a == _('\0')) return true; - a++; b++; + for (String::const_iterator a_it = as.begin(); a_it != as.end(); ++a_it, ++b) { + if (*a_it != *b && !(*a_it == '_' && *b == ' ')) { + return false; + } } + return true; } size_t find_i(const String& heystack, const String& needle) {