22 static ssize_t fb_hFindQS
27 const char *pachPattern,
31 ssize_t max_size = len_text - len_pattern + 1;
36 for( i=0; i!=256; ++i)
37 qs_bc[ i ] = len_pattern + 1;
38 for( i=0; i!=len_pattern; ++i )
46 if( memcmp( pachPattern, pachText + i, len_pattern )==0 ) {
80 const char *pachPattern,
84 ssize_t i, j, len_max = len_text - len_pattern;
86 ssize_t *bm_gc, *suffixes;
89 bm_gc = (ssize_t*) malloc(
sizeof(ssize_t) * (len_pattern + 1));
90 suffixes = (ssize_t*) malloc(
sizeof(ssize_t) * (len_pattern + 1));
92 memset( bm_gc, 0,
sizeof(ssize_t) * (len_pattern+1) );
93 memset( suffixes, 0,
sizeof(ssize_t) * (len_pattern+1) );
96 memset(bm_bc, -1,
sizeof(bm_bc));
97 for( i=0; i!=len_pattern; ++i )
101 i = len_pattern; j=len_pattern+1;
106 char ch1 = pachPattern[i-1];
107 while ( j<=len_pattern && ch1!=pachPattern[j-1] )
120 for( i=0; i<=len_pattern; ++i )
132 while( i <= len_max )
136 while( j!=0 && pachPattern[j-1]==pachText[i+j-1] )
146 char chText = pachText[i+j-1];
147 ssize_t shift_gc = bm_gc[j];
149 i += ( (shift_gc > shift_bc) ? shift_gc : shift_bc );
163 const char *pachText,
165 const char *pachPattern,
170 ssize_t imax = (len_text - len_pattern + 1);
174 for( i=start; i != imax; ++i ) {
176 for( j=0; j!=len_pattern; ++j ) {
177 if( pachText[j]!=pachPattern[j] )
203 if( (size_src == 0) || (size_patt == 0) ||
204 ((start < 1) || (start > size_src)) || (size_patt > size_src) )
208 else if( size_patt==1 )
210 const char *pszEnd = (
const char *)
FB_MEMCHR( src->
data + start - 1, patt->
data[0], size_src - start + 1);
217 r = pszEnd - src->
data + 1;
225 patt->
data, size_patt );