+2007-07-02 David Lawrence Ramsey <pooka109@gmail.com>
+
+ * chars.c (nstrcasestr, mbstrcasestr, revstrstr, revstrcasestr,
+ mbrevstrcasestr): For efficiency, return haystack immediately if
+ needle is blank.
+
2007-07-01 David Lawrence Ramsey <pooka109@gmail.com>
* chars.c (nstrncasecmp, mbstrncasecmp): For efficiency, return
{
assert(haystack != NULL && needle != NULL);
+ if (needle == '\0')
+ return haystack;
+
for (; *haystack != '\0'; haystack++) {
const char *r = haystack, *q = needle;
assert(haystack != NULL && needle != NULL);
+ if (needle == '\0')
+ return haystack;
+
r_mb = charalloc(MB_CUR_MAX);
q_mb = charalloc(MB_CUR_MAX);
{
assert(haystack != NULL && needle != NULL && rev_start != NULL);
+ if (needle == '\0')
+ return rev_start;
+
for (; rev_start >= haystack; rev_start--) {
const char *r, *q;
{
assert(haystack != NULL && needle != NULL && rev_start != NULL);
+ if (needle == '\0')
+ return rev_start;
+
for (; rev_start >= haystack; rev_start--) {
const char *r = rev_start, *q = needle;
assert(haystack != NULL && needle != NULL && rev_start != NULL);
+ if (needle == '\0')
+ return rev_start;
+
r_mb = charalloc(MB_CUR_MAX);
q_mb = charalloc(MB_CUR_MAX);