From 73e6ab4a91444f4c2e4a4a7a3510fb7f09067949 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sat, 6 Nov 2010 20:19:08 +0100 Subject: [PATCH] moved string.h utility code over to Builtin.py to make it generally available to other modules --- Cython/Compiler/Builtin.py | 6 ++++++ Cython/Compiler/Optimize.py | 11 ++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Cython/Compiler/Builtin.py b/Cython/Compiler/Builtin.py index bafccd04..e5226d78 100644 --- a/Cython/Compiler/Builtin.py +++ b/Cython/Compiler/Builtin.py @@ -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 +""" +) + iter_next_utility_code = UtilityCode( proto = """ #define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL); diff --git a/Cython/Compiler/Optimize.py b/Cython/Compiler/Optimize.py index e97aea88..f70a68e3 100644 --- a/Cython/Compiler/Optimize.py +++ b/Cython/Compiler/Optimize.py @@ -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 -""" -) - - tpnew_utility_code = UtilityCode( proto = """ static CYTHON_INLINE PyObject* __Pyx_tp_new(PyObject* type_obj) { -- 2.26.2