From da89f5ef6bc33782b88a5f2114846dfd90903272 Mon Sep 17 00:00:00 2001 From: Justin Viiret Date: Thu, 21 Apr 2016 13:57:57 +1000 Subject: [PATCH] ue2string: bring caseless cmp inline --- src/util/ue2string.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/util/ue2string.cpp b/src/util/ue2string.cpp index 4b166196..6fdc57ba 100644 --- a/src/util/ue2string.cpp +++ b/src/util/ue2string.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Intel Corporation + * Copyright (c) 2015-2016, Intel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -173,7 +173,16 @@ size_t maxStringSelfOverlap(const string &a, bool nocase) { } u32 cmp(const char *a, const char *b, size_t len, bool nocase) { - return cmpForward((const u8 *)a, (const u8 *)b, len, nocase); + if (!nocase) { + return memcmp(a, b, len); + } + + for (const auto *a_end = a + len; a < a_end; a++, b++) { + if (mytoupper(*a) != mytoupper(*b)) { + return 1; + } + } + return 0; } case_iter::case_iter(const ue2_literal &ss) : s(ss.get_string()),