diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-07-01 14:57:30 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-07-01 14:57:30 (GMT) |
commit | 355048970b2aef708c5b9f8e5cfcbf56596d94b1 (patch) | |
tree | 079f856669a438ba004dbed315ae3a876f6ce61f /Objects/stringlib | |
parent | 0855e706aa7fed842e18b0ce14e18d6574318643 (diff) | |
download | cpython-355048970b2aef708c5b9f8e5cfcbf56596d94b1.zip cpython-355048970b2aef708c5b9f8e5cfcbf56596d94b1.tar.gz cpython-355048970b2aef708c5b9f8e5cfcbf56596d94b1.tar.bz2 |
Issue #26765: Moved wrappers for bytes and bytearray methods to common header
file.
Diffstat (limited to 'Objects/stringlib')
-rw-r--r-- | Objects/stringlib/transmogrify.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/Objects/stringlib/transmogrify.h b/Objects/stringlib/transmogrify.h index 625507d..fb62d63 100644 --- a/Objects/stringlib/transmogrify.h +++ b/Objects/stringlib/transmogrify.h @@ -2,6 +2,60 @@ # error "transmogrify.h only compatible with byte-wise strings" #endif +Py_LOCAL(PyObject *) +stringlib_method_find(PyObject *self, PyObject *args) +{ + return _Py_bytes_find(STRINGLIB_STR(self), STRINGLIB_LEN(self), args); +} + +Py_LOCAL(PyObject *) +stringlib_index(PyObject *self, PyObject *args) +{ + return _Py_bytes_index(STRINGLIB_STR(self), STRINGLIB_LEN(self), args); +} + +Py_LOCAL(PyObject *) +stringlib_method_rfind(PyObject *self, PyObject *args) +{ + return _Py_bytes_rfind(STRINGLIB_STR(self), STRINGLIB_LEN(self), args); +} + +Py_LOCAL(PyObject *) +stringlib_rindex(PyObject *self, PyObject *args) +{ + return _Py_bytes_rindex(STRINGLIB_STR(self), STRINGLIB_LEN(self), args); +} + +Py_LOCAL(PyObject *) +stringlib_method_count(PyObject *self, PyObject *args) +{ + return _Py_bytes_count(STRINGLIB_STR(self), STRINGLIB_LEN(self), args); +} + +Py_LOCAL(int) +stringlib_contains(PyObject *self, PyObject *arg) +{ + return _Py_bytes_contains(STRINGLIB_STR(self), STRINGLIB_LEN(self), arg); +} + +Py_LOCAL(PyObject *) +stringlib_startswith(PyObject *self, PyObject *args) +{ + return _Py_bytes_startswith(STRINGLIB_STR(self), STRINGLIB_LEN(self), args); +} + +Py_LOCAL(PyObject *) +stringlib_endswith(PyObject *self, PyObject *args) +{ + return _Py_bytes_endswith(STRINGLIB_STR(self), STRINGLIB_LEN(self), args); +} + +Py_LOCAL(PyObject *) +stringlib_hex(PyObject *self) +{ + return _Py_strhex(STRINGLIB_STR(self), STRINGLIB_LEN(self)); +} + /* the more complicated methods. parts of these should be pulled out into the shared code in bytes_methods.c to cut down on duplicate code bloat. */ |