Staging
v0.5.1
Revision bb417dcc49def0582d50d94eddcd6172214e61d5 authored by Martin v. Löwis on 10 September 2008, 21:15:32 UTC, committed by Martin v. Löwis on 10 September 2008, 21:15:32 UTC
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r66369 | martin.v.loewis | 2008-09-10 21:16:35 +0200 (Mi, 10 Sep 2008) | 4 lines

  Read unidata_version from unicodedata module.
  Delete old NormalizationTest.txt if it doesn't match
  unidata_version.
........
1 parent 6dfcb02
Raw File
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