Commit 73e6ab4a authored by Stefan Behnel's avatar Stefan Behnel

moved string.h utility code over to Builtin.py to make it generally available to other modules

parent e35445d1
......@@ -160,6 +160,12 @@ proto = """
#define __Pyx_PyNumber_Power2(a, b) PyNumber_Power(a, b, Py_None)
""")
include_string_h_utility_code = UtilityCode(
proto = """
#include <string.h>
"""
)
iter_next_utility_code = UtilityCode(
proto = """
#define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL);
......
......@@ -1854,7 +1854,7 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform):
node.pos, "strlen", self.Pyx_strlen_func_type,
args = [arg],
is_temp = node.is_temp,
utility_code = include_string_h_utility_code)
utility_code = Builtin.include_string_h_utility_code)
elif arg.type.is_pyobject:
cfunc_name = self._map_to_capi_len_function(arg.type)
if cfunc_name is None:
......@@ -2514,7 +2514,7 @@ class OptimizeBuiltinCalls(Visitor.EnvTransform):
string_node.pos, "strlen", self.Pyx_strlen_func_type,
args = [string_node],
is_temp = False,
utility_code = include_string_h_utility_code,
utility_code = Builtin.include_string_h_utility_code,
).coerce_to(PyrexTypes.c_py_ssize_t_type, self.current_env())
elif start:
stop = ExprNodes.SubNode(
......@@ -2894,13 +2894,6 @@ static CYTHON_INLINE char __Pyx_PyBytes_GetItemInt(PyObject* bytes, Py_ssize_t i
)
include_string_h_utility_code = UtilityCode(
proto = """
#include <string.h>
"""
)
tpnew_utility_code = UtilityCode(
proto = """
static CYTHON_INLINE PyObject* __Pyx_tp_new(PyObject* type_obj) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment