Author: Amaury Forgeot d'Arc <[email protected]>
Branch: py3k
Changeset: r59094:1ede0e7ded5d
Date: 2012-11-23 15:54 +0100
http://bitbucket.org/pypy/pypy/changeset/1ede0e7ded5d/

Log:    Implement Py_UNICODE_strcmp

diff --git a/pypy/module/cpyext/include/unicodeobject.h 
b/pypy/module/cpyext/include/unicodeobject.h
--- a/pypy/module/cpyext/include/unicodeobject.h
+++ b/pypy/module/cpyext/include/unicodeobject.h
@@ -39,7 +39,19 @@
     return res;
 }
 
-
+Py_LOCAL_INLINE(int)
+Py_UNICODE_strcmp(const Py_UNICODE *s1, const Py_UNICODE *s2)
+{
+    while (*s1 && *s2 && *s1 == *s2)
+        s1++, s2++;
+    if (*s1 && *s2)
+        return (*s1 < *s2) ? -1 : +1;
+    if (*s1)
+        return 1;
+    if (*s2)
+        return -1;
+    return 0;
+}
 
 #ifdef __cplusplus
 }
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to