3 unsigned int bird( char **text
, char **pattern
, int m
, int n
)
5 /* x and y can be -1 */
8 unsigned int i
, row
, matches
= 0;
11 for ( row
= 0; row
< n
- m
+ 1; row
++ ) {
15 /* Iterate through results on the same row */
18 x
= aho( text
, pattern
, m
, n
, row
, x
, 0, n
- m
+ 1 );
20 /* If a row is found, check the m - 1 rows underneath it for matches */
23 for ( i
= 1; i
< m
; i
++) {
24 /* Optimization: instead of checking against n chars on
25 subsequent rows, just check against the next m chars after x */
26 y
= aho( text
, pattern
, m
, n
, row
+ i
, x
, i
, x
+ m
);
31 /* If we reached to the final line above x without breaking, we have a match */
35 /* After each attempt,increase the counter + 1 */