Commits

Amaury Forgeot d'Arc  committed 1ede0e7

Implement Py_UNICODE_strcmp

  • Participants
  • Parent commits 5a4ef28
  • Branches py3k

Comments (0)

Files changed (1)

File pypy/module/cpyext/include/unicodeobject.h

     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
 }