1 /* stringlib: count implementation */
3 #ifndef STRINGLIB_COUNT_H
4 #define STRINGLIB_COUNT_H
6 #ifndef STRINGLIB_FASTSEARCH_H
7 #error must include "stringlib/fastsearch.h" before including this module
10 Py_LOCAL_INLINE(Py_ssize_t
)
11 stringlib_count(const STRINGLIB_CHAR
* str
, Py_ssize_t str_len
,
12 const STRINGLIB_CHAR
* sub
, Py_ssize_t sub_len
)
17 return 0; /* start > len(str) */
21 count
= fastsearch(str
, str_len
, sub
, sub_len
, FAST_COUNT
);
24 count
= 0; /* no match */