summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2024-05-13 15:48:00 -0700
committerThiago Macieira <thiago.macieira@intel.com>2024-05-18 19:30:54 -0700
commiteeb6f0337e21940240bf586420b55845d122896a (patch)
tree1e523b5aa9edd6959ca9eb2a2cb296da0c7198fb
parent112e554cbf787fa6b093354d75889f520307c33e (diff)
QByteArray: de-duplicate the find-one-char function
We have a public, inlineable one, so use that one instead of the private copy. They do the same thing. Task-number: QTBUG-125283 Change-Id: If05cb740b64f42eba21efffd17cf2ded689e0691 Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
-rw-r--r--src/corelib/text/qbytearraymatcher.cpp19
1 files changed, 1 insertions, 18 deletions
diff --git a/src/corelib/text/qbytearraymatcher.cpp b/src/corelib/text/qbytearraymatcher.cpp
index ae38fb584b..411766c46e 100644
--- a/src/corelib/text/qbytearraymatcher.cpp
+++ b/src/corelib/text/qbytearraymatcher.cpp
@@ -212,23 +212,6 @@ qsizetype QByteArrayMatcher::indexIn(QByteArrayView data, qsizetype from) const
\sa setPattern()
*/
-
-static qsizetype findChar(const char *str, qsizetype len, char ch, qsizetype from)
-{
- const uchar *s = (const uchar *)str;
- uchar c = (uchar)ch;
- if (from < 0)
- from = qMax(from + len, qsizetype(0));
- if (from < len) {
- const uchar *n = s + from - 1;
- const uchar *e = s + len;
- while (++n != e)
- if (*n == c)
- return n - s;
- }
- return -1;
-}
-
/*!
\internal
*/
@@ -268,7 +251,7 @@ qsizetype qFindByteArray(
return -1;
if (sl == 1)
- return findChar(haystack0, haystackLen, needle[0], from);
+ return QtPrivate::findByteArray({ haystack0, haystackLen }, from, needle[0]);
/*
We use the Boyer-Moore algorithm in cases where the overhead