X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fstrstr.c;h=e1f9697a3f9fc2fbeeab81224b6fb25e7fdce21e;hb=bbfcd2f1a92c9bdbb8d7d7d0a8a8c6665c316747;hp=338be82a88ed5d96fb63abd7f5815b23ee706e8a;hpb=c358da1eb79a1af4d7e4b887ca3896fb7f3fdcdb;p=gnulib.git diff --git a/lib/strstr.c b/lib/strstr.c index 338be82a8..e1f9697a3 100644 --- a/lib/strstr.c +++ b/lib/strstr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,92,93,94,96,97,98,2000,2004,2007,2008 Free Software +/* Copyright (C) 1991-1994, 1996-1998, 2000, 2004, 2007-2013 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -13,8 +13,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + with this program; if not, see . */ /* This particular implementation was written by Eric Blake, 2008. */ @@ -32,8 +31,8 @@ #endif #define RETURN_TYPE char * -#define AVAILABLE(h, h_l, j, n_l) \ - (!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l)) \ +#define AVAILABLE(h, h_l, j, n_l) \ + (!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l)) \ && ((h_l) = (j) + (n_l))) #include "str-two-way.h" @@ -67,17 +66,17 @@ strstr (const char *haystack_start, const char *needle_start) return (char *) haystack; needle -= needle_len; haystack_len = (haystack > haystack_start + needle_len ? 1 - : needle_len + haystack_start - haystack); + : needle_len + haystack_start - haystack); /* Perform the search. Abstract memory is considered to be an array of 'unsigned char' values, not an array of 'char' values. See ISO C 99 section 6.2.6.1. */ if (needle_len < LONG_NEEDLE_THRESHOLD) return two_way_short_needle ((const unsigned char *) haystack, - haystack_len, - (const unsigned char *) needle, needle_len); + haystack_len, + (const unsigned char *) needle, needle_len); return two_way_long_needle ((const unsigned char *) haystack, haystack_len, - (const unsigned char *) needle, needle_len); + (const unsigned char *) needle, needle_len); } #undef LONG_NEEDLE_THRESHOLD