X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fstrstr.c;h=265fc8533ac0d9ea7b9dd24a1230556301ecc348;hb=fbe6ced5d2fdadeeea4194725d05a52cf3b5ebd7;hp=338be82a88ed5d96fb63abd7f5815b23ee706e8a;hpb=c358da1eb79a1af4d7e4b887ca3896fb7f3fdcdb;p=gnulib.git diff --git a/lib/strstr.c b/lib/strstr.c index 338be82a8..265fc8533 100644 --- a/lib/strstr.c +++ b/lib/strstr.c @@ -1,5 +1,5 @@ -/* Copyright (C) 1991,92,93,94,96,97,98,2000,2004,2007,2008 Free Software - Foundation, Inc. +/* Copyright (C) 1991, 1992, 1993, 1994, 1996, 1997, 1998, 2000, 2004, 2007, + 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify @@ -32,8 +32,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 +67,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