1@node memmem
2@subsection @code{memmem}
3@findex memmem
4
5LSB specification:@* @url{https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/baselib-memmem-3.html}
6
7Documentation:
8@itemize
9@item
10@ifinfo
11@ref{Search Functions,,Search Functions,libc},
12@end ifinfo
13@ifnotinfo
14@url{https://www.gnu.org/software/libc/manual/html_node/Search-Functions.html},
15@end ifnotinfo
16@item
17@uref{https://www.kernel.org/doc/man-pages/online/pages/man3/memmem.3.html,,man memmem}.
18@end itemize
19
20Gnulib module: memmem or memmem-simple
21
22Both modules implement the same replacement for the @code{memmem} function
23with the @code{memmem} module providing a replacement on more platforms where
24the existing @code{memmem} function has a quadratic worst-case complexity.
25
26Portability problems fixed by either Gnulib module @code{memmem-simple}
27or @code{memmem}:
28@itemize
29@item
30This function is missing on some platforms:
31Mac OS X 10.5, FreeBSD 5.2.1, OpenBSD 4.0, Minix 3.1.8, HP-UX 11, IRIX 6.5, Solaris 10, mingw, MSVC 14.
32@item
33This function has reversed arguments on some older platforms:
34Linux libc 5.0.9
35@item
36This function can trigger false positives for long periodic needles on
37some platforms:
38glibc 2.12, Cygwin 1.7.7.
39
40@item
41This function returns incorrect values in some cases, such as when
42given an empty needle:
43glibc <= 2.0, Solaris 11.4, Cygwin 1.5.x.
44@end itemize
45
46Performance problems fixed by Gnulib module @code{memmem}:
47@itemize
48@item
49This function has quadratic instead of linear worst-case complexity on some
50platforms:
51glibc 2.8, FreeBSD 6.2, NetBSD 9.0, AIX 5.1, Solaris 11.4, Cygwin 1.5.x.
52Note for small needles the replacement may be slower.
53@end itemize
54
55Portability problems not fixed by Gnulib:
56@itemize
57@end itemize
58