Staging
v0.5.1
https://github.com/python/cpython
Revision db6fa182a7cb8dbf1072aa2f54893dec54a1f96e authored by Mark Dickinson on 29 March 2009, 16:25:46 UTC, committed by Mark Dickinson on 29 March 2009, 16:25:46 UTC
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r70684 | mark.dickinson | 2009-03-29 17:24:29 +0100 (Sun, 29 Mar 2009) | 3 lines

  Issue #532631: Apply floatformat changes to unicodeobject.c
  as well as stringobject.c.
........
1 parent 8788619
Raw File
Tip revision: db6fa182a7cb8dbf1072aa2f54893dec54a1f96e authored by Mark Dickinson on 29 March 2009, 16:25:46 UTC
Merged revisions 70684 via svnmerge from
Tip revision: db6fa18
pystrcmp.c
/* Cross platform case insensitive string compare functions
 */

#include "Python.h"

int
PyOS_mystrnicmp(const char *s1, const char *s2, Py_ssize_t size)
{
	if (size == 0)
		return 0;
	while ((--size > 0) &&
	       (tolower((unsigned)*s1) == tolower((unsigned)*s2))) {
		if (!*s1++ || !*s2++)
			break;
	}
	return tolower((unsigned)*s1) - tolower((unsigned)*s2);
}

int
PyOS_mystricmp(const char *s1, const char *s2)
{
	while (*s1 && (tolower((unsigned)*s1++) == tolower((unsigned)*s2++))) {
		;
	}
	return (tolower((unsigned)*s1) - tolower((unsigned)*s2));
}
back to top