Commit ec7f7d31 authored by Stefan Behnel's avatar Stefan Behnel

move StrEq() utility code to StringTools.c

parent c960580f
......@@ -1962,7 +1962,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
"};")
def generate_import_star(self, env, code):
env.use_utility_code(streq_utility_code)
env.use_utility_code(UtilityCode.load_cached("CStringEquals", "StringTools.c"))
code.putln()
code.enter_cfunc_scope() # as we need labels
code.putln("static int %s(PyObject *o, PyObject* py_name, char *name) {" % Naming.import_star_set)
......@@ -2811,19 +2811,6 @@ def generate_cfunction_declaration(entry, env, code, definition):
#
#------------------------------------------------------------------------------------
streq_utility_code = UtilityCode(
proto = """
static CYTHON_INLINE int __Pyx_StrEq(const char *, const char *); /*proto*/
""",
impl = """
static CYTHON_INLINE int __Pyx_StrEq(const char *s1, const char *s2) {
while (*s1 != '\\0' && *s1 == *s2) { s1++; s2++; }
return *s1 == *s2;
}
""")
#------------------------------------------------------------------------------------
refnanny_utility_code = UtilityCode.load("Refnanny", "ModuleSetupCode.c")
packed_struct_utility_code = UtilityCode(proto="""
......
......@@ -117,6 +117,18 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Contains(PyObject* substring, PyObject*
}
//////////////////// CStringEquals.proto ////////////////////
static CYTHON_INLINE int __Pyx_StrEq(const char *, const char *); /*proto*/
//////////////////// CStringEquals ////////////////////
static CYTHON_INLINE int __Pyx_StrEq(const char *s1, const char *s2) {
while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
return *s1 == *s2;
}
//////////////////// StrEquals.proto ////////////////////
//@requires: BytesEquals
//@requires: UnicodeEquals
......
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