/home/mdboom/Work/builds/cpython/Objects/stringlib/count.h
Line | Count | Source |
1 | /* stringlib: count implementation */ |
2 | |
3 | #ifndef STRINGLIB_FASTSEARCH_H |
4 | #error must include "stringlib/fastsearch.h" before including this module |
5 | #endif |
6 | |
7 | Py_LOCAL_INLINE(Py_ssize_t) |
8 | STRINGLIB(count)(const STRINGLIB_CHAR* str, Py_ssize_t str_len, |
9 | const STRINGLIB_CHAR* sub, Py_ssize_t sub_len, |
10 | Py_ssize_t maxcount) |
11 | { |
12 | Py_ssize_t count; |
13 | |
14 | if (str_len < 0) Branch (14:9): [True: 12, False: 140k]
Branch (14:9): [True: 0, False: 42.7k]
Branch (14:9): [True: 0, False: 43.8k]
Branch (14:9): [True: 0, False: 769k]
Branch (14:9): [True: 0, False: 205k]
Branch (14:9): [True: 0, False: 14.2k]
Branch (14:9): [True: 0, False: 825]
|
15 | return 0; /* start > len(str) */ |
16 | if (sub_len == 0) Branch (16:9): [True: 520, False: 140k]
Branch (16:9): [True: 0, False: 42.7k]
Branch (16:9): [True: 0, False: 43.8k]
Branch (16:9): [True: 28, False: 769k]
Branch (16:9): [True: 520, False: 205k]
Branch (16:9): [True: 0, False: 14.2k]
Branch (16:9): [True: 0, False: 825]
|
17 | return (str_len < maxcount) ? str_len + 11.06k : maxcount6 ; Branch (17:16): [True: 520, False: 0]
Branch (17:16): [True: 0, False: 0]
Branch (17:16): [True: 0, False: 0]
Branch (17:16): [True: 22, False: 6]
Branch (17:16): [True: 520, False: 0]
Branch (17:16): [True: 0, False: 0]
Branch (17:16): [True: 0, False: 0]
|
18 | |
19 | count = FASTSEARCH(str, str_len, sub, sub_len, maxcount, FAST_COUNT); |
20 | |
21 | if (count < 0) Branch (21:9): [True: 43.1k, False: 97.2k]
Branch (21:9): [True: 0, False: 42.7k]
Branch (21:9): [True: 0, False: 43.8k]
Branch (21:9): [True: 0, False: 769k]
Branch (21:9): [True: 0, False: 205k]
Branch (21:9): [True: 0, False: 14.2k]
Branch (21:9): [True: 0, False: 825]
|
22 | return 0; /* no match */ |
23 | |
24 | return count; |
25 | } bytes_methods.c:stringlib_count Line | Count | Source | 11 | { | 12 | Py_ssize_t count; | 13 | | 14 | if (str_len < 0) Branch (14:9): [True: 12, False: 140k]
| 15 | return 0; /* start > len(str) */ | 16 | if (sub_len == 0) Branch (16:9): [True: 520, False: 140k]
| 17 | return (str_len < maxcount) ? str_len + 1 : maxcount0 ; Branch (17:16): [True: 520, False: 0]
| 18 | | 19 | count = FASTSEARCH(str, str_len, sub, sub_len, maxcount, FAST_COUNT); | 20 | | 21 | if (count < 0) Branch (21:9): [True: 43.1k, False: 97.2k]
| 22 | return 0; /* no match */ | 23 | | 24 | return count; | 25 | } |
bytearrayobject.c:stringlib_count Line | Count | Source | 11 | { | 12 | Py_ssize_t count; | 13 | | 14 | if (str_len < 0) Branch (14:9): [True: 0, False: 42.7k]
| 15 | return 0; /* start > len(str) */ | 16 | if (sub_len == 0) Branch (16:9): [True: 0, False: 42.7k]
| 17 | return (str_len < maxcount) ? str_len + 1 : maxcount; Branch (17:16): [True: 0, False: 0]
| 18 | | 19 | count = FASTSEARCH(str, str_len, sub, sub_len, maxcount, FAST_COUNT); | 20 | | 21 | if (count < 0) Branch (21:9): [True: 0, False: 42.7k]
| 22 | return 0; /* no match */ | 23 | | 24 | return count; | 25 | } |
bytesobject.c:stringlib_count Line | Count | Source | 11 | { | 12 | Py_ssize_t count; | 13 | | 14 | if (str_len < 0) Branch (14:9): [True: 0, False: 43.8k]
| 15 | return 0; /* start > len(str) */ | 16 | if (sub_len == 0) Branch (16:9): [True: 0, False: 43.8k]
| 17 | return (str_len < maxcount) ? str_len + 1 : maxcount; Branch (17:16): [True: 0, False: 0]
| 18 | | 19 | count = FASTSEARCH(str, str_len, sub, sub_len, maxcount, FAST_COUNT); | 20 | | 21 | if (count < 0) Branch (21:9): [True: 0, False: 43.8k]
| 22 | return 0; /* no match */ | 23 | | 24 | return count; | 25 | } |
unicodeobject.c:asciilib_count Line | Count | Source | 11 | { | 12 | Py_ssize_t count; | 13 | | 14 | if (str_len < 0) Branch (14:9): [True: 0, False: 769k]
| 15 | return 0; /* start > len(str) */ | 16 | if (sub_len == 0) Branch (16:9): [True: 28, False: 769k]
| 17 | return (str_len < maxcount) ? str_len + 122 : maxcount6 ; Branch (17:16): [True: 22, False: 6]
| 18 | | 19 | count = FASTSEARCH(str, str_len, sub, sub_len, maxcount, FAST_COUNT); | 20 | | 21 | if (count < 0) Branch (21:9): [True: 0, False: 769k]
| 22 | return 0; /* no match */ | 23 | | 24 | return count; | 25 | } |
unicodeobject.c:ucs1lib_count Line | Count | Source | 11 | { | 12 | Py_ssize_t count; | 13 | | 14 | if (str_len < 0) Branch (14:9): [True: 0, False: 205k]
| 15 | return 0; /* start > len(str) */ | 16 | if (sub_len == 0) Branch (16:9): [True: 520, False: 205k]
| 17 | return (str_len < maxcount) ? str_len + 1 : maxcount0 ; Branch (17:16): [True: 520, False: 0]
| 18 | | 19 | count = FASTSEARCH(str, str_len, sub, sub_len, maxcount, FAST_COUNT); | 20 | | 21 | if (count < 0) Branch (21:9): [True: 0, False: 205k]
| 22 | return 0; /* no match */ | 23 | | 24 | return count; | 25 | } |
unicodeobject.c:ucs2lib_count Line | Count | Source | 11 | { | 12 | Py_ssize_t count; | 13 | | 14 | if (str_len < 0) Branch (14:9): [True: 0, False: 14.2k]
| 15 | return 0; /* start > len(str) */ | 16 | if (sub_len == 0) Branch (16:9): [True: 0, False: 14.2k]
| 17 | return (str_len < maxcount) ? str_len + 1 : maxcount; Branch (17:16): [True: 0, False: 0]
| 18 | | 19 | count = FASTSEARCH(str, str_len, sub, sub_len, maxcount, FAST_COUNT); | 20 | | 21 | if (count < 0) Branch (21:9): [True: 0, False: 14.2k]
| 22 | return 0; /* no match */ | 23 | | 24 | return count; | 25 | } |
unicodeobject.c:ucs4lib_count Line | Count | Source | 11 | { | 12 | Py_ssize_t count; | 13 | | 14 | if (str_len < 0) Branch (14:9): [True: 0, False: 825]
| 15 | return 0; /* start > len(str) */ | 16 | if (sub_len == 0) Branch (16:9): [True: 0, False: 825]
| 17 | return (str_len < maxcount) ? str_len + 1 : maxcount; Branch (17:16): [True: 0, False: 0]
| 18 | | 19 | count = FASTSEARCH(str, str_len, sub, sub_len, maxcount, FAST_COUNT); | 20 | | 21 | if (count < 0) Branch (21:9): [True: 0, False: 825]
| 22 | return 0; /* no match */ | 23 | | 24 | return count; | 25 | } |
|
26 | |
27 | |