diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
commit | 718c552901d703c502ccbefdfc3c9028d608b947 (patch) | |
tree | 46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/tools/python3/src/Objects/stringlib/count.h | |
parent | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff) | |
download | ydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Objects/stringlib/count.h')
-rw-r--r-- | contrib/tools/python3/src/Objects/stringlib/count.h | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/contrib/tools/python3/src/Objects/stringlib/count.h b/contrib/tools/python3/src/Objects/stringlib/count.h index f48500bf56..794224d015 100644 --- a/contrib/tools/python3/src/Objects/stringlib/count.h +++ b/contrib/tools/python3/src/Objects/stringlib/count.h @@ -1,27 +1,27 @@ -/* stringlib: count implementation */ - -#ifndef STRINGLIB_FASTSEARCH_H -#error must include "stringlib/fastsearch.h" before including this module -#endif - -Py_LOCAL_INLINE(Py_ssize_t) -STRINGLIB(count)(const STRINGLIB_CHAR* str, Py_ssize_t str_len, - const STRINGLIB_CHAR* sub, Py_ssize_t sub_len, - Py_ssize_t maxcount) -{ - Py_ssize_t count; - - if (str_len < 0) - return 0; /* start > len(str) */ - if (sub_len == 0) - return (str_len < maxcount) ? str_len + 1 : maxcount; - - count = FASTSEARCH(str, str_len, sub, sub_len, maxcount, FAST_COUNT); - - if (count < 0) - return 0; /* no match */ - - return count; -} - - +/* stringlib: count implementation */ + +#ifndef STRINGLIB_FASTSEARCH_H +#error must include "stringlib/fastsearch.h" before including this module +#endif + +Py_LOCAL_INLINE(Py_ssize_t) +STRINGLIB(count)(const STRINGLIB_CHAR* str, Py_ssize_t str_len, + const STRINGLIB_CHAR* sub, Py_ssize_t sub_len, + Py_ssize_t maxcount) +{ + Py_ssize_t count; + + if (str_len < 0) + return 0; /* start > len(str) */ + if (sub_len == 0) + return (str_len < maxcount) ? str_len + 1 : maxcount; + + count = FASTSEARCH(str, str_len, sub, sub_len, maxcount, FAST_COUNT); + + if (count < 0) + return 0; /* no match */ + + return count; +} + + |