diff options
author | Eric Smith <eric@trueblade.com> | 2007-08-28 09:45:15 (GMT) |
---|---|---|
committer | Eric Smith <eric@trueblade.com> | 2007-08-28 09:45:15 (GMT) |
commit | 79710cdea1975c633c63bb25b25f92ac61a976e2 (patch) | |
tree | e665b363aa03e69ca79815da5c12c90f27561de8 /Objects/stringlib | |
parent | 3d5cb22514b408b3a6f6167fa53345e6dca58908 (diff) | |
download | cpython-79710cdea1975c633c63bb25b25f92ac61a976e2.zip cpython-79710cdea1975c633c63bb25b25f92ac61a976e2.tar.gz cpython-79710cdea1975c633c63bb25b25f92ac61a976e2.tar.bz2 |
Changed STRINGLIB_CMP from an inline function to a macro in order to avoid a 'defined but not used' warning.
Diffstat (limited to 'Objects/stringlib')
-rw-r--r-- | Objects/stringlib/unicodedefs.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Objects/stringlib/unicodedefs.h b/Objects/stringlib/unicodedefs.h index 1fac2c3..a50a3f2 100644 --- a/Objects/stringlib/unicodedefs.h +++ b/Objects/stringlib/unicodedefs.h @@ -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 @@ STRINGLIB_CMP(const Py_UNICODE* str, const Py_UNICODE* other, Py_ssize_t len) 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 */ |