[Python-3000-checkins] r57613 - python/branches/py3k/Objects/stringlib/unicodedefs.h
eric.smith
python-3000-checkins at python.org
Tue Aug 28 11:45:15 CEST 2007
Author: eric.smith
Date: Tue Aug 28 11:45:15 2007
New Revision: 57613
Modified:
python/branches/py3k/Objects/stringlib/unicodedefs.h
Log:
Changed STRINGLIB_CMP from an inline function to a macro in order to avoid a 'defined but not used' warning.
Modified: python/branches/py3k/Objects/stringlib/unicodedefs.h
==============================================================================
--- python/branches/py3k/Objects/stringlib/unicodedefs.h (original)
+++ python/branches/py3k/Objects/stringlib/unicodedefs.h Tue Aug 28 11:45:15 2007
@@ -21,6 +21,8 @@
#define STRINGLIB_CHECK PyUnicode_Check
#define STRINGLIB_TOSTR PyObject_Unicode
+/* STRINGLIB_CMP was defined as:
+
Py_LOCAL_INLINE(int)
STRINGLIB_CMP(const Py_UNICODE* str, const Py_UNICODE* other, Py_ssize_t len)
{
@@ -29,4 +31,13 @@
return memcmp((void*) str, (void*) other, len * sizeof(Py_UNICODE));
}
+but unfortunately that gives a error if the function isn't used in a file that
+includes this file. So, reluctantly convert it to a macro instead. */
+
+#define STRINGLIB_CMP(str, other, len) \
+ (((str)[0] != (other)[0]) ? \
+ 1 : \
+ memcmp((void*) (str), (void*) (other), (len) * sizeof(Py_UNICODE)))
+
+
#endif /* !STRINGLIB_UNICODEDEFS_H */
More information about the Python-3000-checkins
mailing list