OLD | NEW |
1 /* Copyright (C) 1991, 1992, 1993, 1994, 1996, 1997, 1998, 2000, 2004, 2007, | 1 /* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2012 Free Software |
2 2008, 2009, 2010, 2011 Free Software Foundation, Inc. | 2 Foundation, Inc. |
3 This file is part of the GNU C Library. | 3 This file is part of the GNU C Library. |
4 | 4 |
5 This program is free software; you can redistribute it and/or modify | 5 This program is free software; you can redistribute it and/or modify |
6 it under the terms of the GNU General Public License as published by | 6 it under the terms of the GNU General Public License as published by |
7 the Free Software Foundation; either version 3, or (at your option) | 7 the Free Software Foundation; either version 3, or (at your option) |
8 any later version. | 8 any later version. |
9 | 9 |
10 This program is distributed in the hope that it will be useful, | 10 This program is distributed in the hope that it will be useful, |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 GNU General Public License for more details. | 13 GNU General Public License for more details. |
14 | 14 |
15 You should have received a copy of the GNU General Public License along | 15 You should have received a copy of the GNU General Public License along |
16 with this program; if not, write to the Free Software Foundation, | 16 with this program; if not, see <http://www.gnu.org/licenses/>. */ |
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | |
18 | 17 |
19 /* This particular implementation was written by Eric Blake, 2008. */ | 18 /* This particular implementation was written by Eric Blake, 2008. */ |
20 | 19 |
21 #ifndef _LIBC | 20 #ifndef _LIBC |
22 # include <config.h> | 21 # include <config.h> |
23 #endif | 22 #endif |
24 | 23 |
25 /* Specification of memmem. */ | 24 /* Specification of memmem. */ |
26 #include <string.h> | 25 #include <string.h> |
27 | 26 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 haystack_len -= haystack - (const unsigned char *) haystack_start; | 66 haystack_len -= haystack - (const unsigned char *) haystack_start; |
68 if (haystack_len < needle_len) | 67 if (haystack_len < needle_len) |
69 return NULL; | 68 return NULL; |
70 return two_way_short_needle (haystack, haystack_len, needle, needle_len); | 69 return two_way_short_needle (haystack, haystack_len, needle, needle_len); |
71 } | 70 } |
72 else | 71 else |
73 return two_way_long_needle (haystack, haystack_len, needle, needle_len); | 72 return two_way_long_needle (haystack, haystack_len, needle, needle_len); |
74 } | 73 } |
75 | 74 |
76 #undef LONG_NEEDLE_THRESHOLD | 75 #undef LONG_NEEDLE_THRESHOLD |
OLD | NEW |