Staging
v0.5.1
https://github.com/python/cpython
Revision 67543a9dc90f65b679dce6bb32b4147c211e9769 authored by Martin v. Löwis on 08 September 2008, 12:02:45 UTC, committed by Martin v. Löwis on 08 September 2008, 12:02:45 UTC
1 parent ace0bcf
Raw File
Tip revision: 67543a9dc90f65b679dce6bb32b4147c211e9769 authored by Martin v. Löwis on 08 September 2008, 12:02:45 UTC
Allow passing the MSI file name to merge.py.
Tip revision: 67543a9
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