--------------------- PatchSet 10301 Date: 2007/12/22 14:55:17 Author: adri Branch: s27_adri Tag: (none) Log: .. And commit the strStrOffset() call. Members: libbuf/String.c:1.1.2.15->1.1.2.16 libbuf/String.h:1.1.2.19->1.1.2.20 Index: squid/libbuf/String.c =================================================================== RCS file: /cvsroot/squid-sf//squid/libbuf/Attic/String.c,v retrieving revision 1.1.2.15 retrieving revision 1.1.2.16 diff -u -r1.1.2.15 -r1.1.2.16 --- squid/libbuf/String.c 19 Dec 2007 07:56:22 -0000 1.1.2.15 +++ squid/libbuf/String.c 22 Dec 2007 14:55:17 -0000 1.1.2.16 @@ -1,6 +1,6 @@ /* - * $Id: String.c,v 1.1.2.15 2007/12/19 07:56:22 adri Exp $ + * $Id: String.c,v 1.1.2.16 2007/12/22 14:55:17 adri Exp $ * * DEBUG: section 67 String * AUTHOR: Duane Wessels @@ -353,11 +353,11 @@ } int -strStr(String haystack, const char *needle) +strStrOffset(String haystack, int offset, const char *needle) { int i; int nl = strlen(needle); - for (i = 0; i < strLen2(haystack) - nl; i++) { + for (i = offset; i < strLen2(haystack) - nl; i++) { if (strncmp(strBuf2(haystack) + i, needle, nl) == 0) return i; } @@ -365,6 +365,12 @@ } int +strStr(String haystack, const char *needle) +{ + return strStrOffset(haystack, 0, needle); +} + +int strCStr(const char *haystack, String needle) { int i; Index: squid/libbuf/String.h =================================================================== RCS file: /cvsroot/squid-sf//squid/libbuf/Attic/String.h,v retrieving revision 1.1.2.19 retrieving revision 1.1.2.20 diff -u -r1.1.2.19 -r1.1.2.20 --- squid/libbuf/String.h 19 Dec 2007 07:56:22 -0000 1.1.2.19 +++ squid/libbuf/String.h 22 Dec 2007 14:55:17 -0000 1.1.2.20 @@ -54,6 +54,7 @@ extern int strNCaseCmp(String s, const char *str, int len); extern int strNCaseCmpOffset(String s, int offset, const char *str, int len); extern int strStr(String s, const char *haystack); +extern int strStrOffset(String s, int offset, const char *haystack); extern int strCStr(const char *n, String h); #define strCaseCmpStr(s1, s2) (strLen2(s1) == strLen2(s2) ? strncasecmp(strBuf2(s1), strBuf2(s2), XMIN(strLen2(s1), strLen2(s2))) : strLen2(s1) - strLen2(s2)) #define strCmpStr(s1, s2) (strLen2(s1) == strLen2(s2) ? strncmp(strBuf2(s1), strBuf2(s2), XMIN(strLen2(s1), strLen2(s2))) : strLen2(s1) - strLen2(s2))