diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2024-05-19 16:43:24 -0500 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2024-06-01 11:27:05 -0300 |
commit | a98715c127fb569c21a0402d3c0e76ca0bb75c0d (patch) | |
tree | 61032d382523714564b6269207f815620331447d /tests/auto/corelib/xml/qxmlstream/data/010.xml | |
parent | e673e5a257569eaa816c6acd31dd754efd9f8c75 (diff) |
Let's just use whatever your C library provides, on the assumption that
it is optimized. Because it does the memchr() call when the size of the
needle is 1, we also skip the 1-char findByteArray() call.
It's been available on Linux since glibc 2.0, FreeBSD since 6.0, OpenBSD
5.4, NetBSD, Apple OSes, etc. even Solaris. If your OS doesn't have it,
you should ask your vendor to add it or consider upgrading to an OS that
already has it.
The glibc implementation[1] also uses a hashing for short needles and
the Two Way string search algorithm it describes as "a bad character
shift table similar to the Boyer-Moore algorithm" for longer ones. The
FreeBSD implementation[2] (which its man page says came from MUSL) uses
1-, 2-, 3-, and 4-byte search specializations before using the Two Way
search algorithm too.
[1] https://codebrowser.dev/glibc/glibc/string/memmem.c.html
[2] https://github.com/freebsd/freebsd-src/blob/main/lib/libc/string/memmem.c
Change-Id: If05cb740b64f42eba21efffd17d101e24528f7fd
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Diffstat (limited to 'tests/auto/corelib/xml/qxmlstream/data/010.xml')
0 files changed, 0 insertions, 0 deletions