moved string.h utility code over to Builtin.py to make it generally available to...
authorStefan Behnel <scoder@users.berlios.de>
Sat, 6 Nov 2010 19:19:08 +0000 (20:19 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Sat, 6 Nov 2010 19:19:08 +0000 (20:19 +0100)
Cython/Compiler/Builtin.py
Cython/Compiler/Optimize.py

index bafccd0411e19aee40f10c14f46e6363beb924e4..e5226d7856ffe1237e01e522f4a575b01cf900f1 100644 (file)
@@ -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);
index e97aea8888053a378c8cbdd6a78ffb2413a352ca..f70a68e3eda58b335c28e9c40699fefcd4bc59be 100644 (file)
@@ -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) {