ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/trunk/lib/libc/string/memmem.c
(Generate patch)

Comparing trunk/lib/libc/string/memmem.c (file contents):
Revision 10523 by laffer1, Sat Dec 7 23:54:44 2013 UTC vs.
Revision 10524 by laffer1, Thu Jun 7 22:35:17 2018 UTC

# Line 42 | Line 42 | memmem(const void *l, size_t l_len, const void *s, siz
42          const char *cl = (const char *)l;
43          const char *cs = (const char *)s;
44  
45 <        /* we need something to compare */
46 <        if (l_len == 0 || s_len == 0)
47 <                return NULL;
45 >        /* empty "s" matches the beginning of "l" */
46 >        if (s_len == 0)
47 >                return (void *)cl;
48  
49          /* "s" must be smaller or equal to "l" */
50          if (l_len < s_len)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines