Lines Matching defs:needle
33 knuth_morris_pratt (const char *haystack, const char *needle,
36 size_t m = strlen (needle);
45 rhaystack[0..i-1] == needle[0..i-1] and rhaystack[i] != needle[i]
47 forall 0 <= x < table[i]: rhaystack[x..x+m-1] != needle[0..m-1],
57 unsigned char b = (unsigned char) needle[i - 1];
61 if (b == (unsigned char) needle[j])
88 if ((unsigned char) needle[j] == (unsigned char) *phaystack)
94 /* The entire needle has been found. */
101 /* Found a match of needle[0..j-1], mismatch at needle[j]. */
107 /* Found a mismatch at needle[0] already. */
119 c_strstr (const char *haystack, const char *needle)
121 /* Be careful not to look at the entire extent of haystack or needle
123 - haystack may be very long, and a match of needle found early,
124 - needle may be very long, and not even a short initial segment of
125 needle may be found in haystack. */
126 if (*needle != '\0')
129 Let n = strlen(haystack), m = strlen(needle).
146 const char *needle_last_ccount = needle; /* = needle + last_ccount */
148 /* Speed up the following searches of needle by caching its first
150 unsigned char b = (unsigned char) *needle;
152 needle++;
165 /* See if needle + comparison_count now reaches the end of
166 needle. */
180 knuth_morris_pratt (haystack, needle - 1, &result);
193 const char *rneedle = needle;