Staging
v0.5.1
Revision 900646ef682ff8aaffca0c2294ed9416d5a1947c authored by Martin v. Löwis on 06 November 2008, 17:30:03 UTC, committed by Martin v. Löwis on 06 November 2008, 17:30:03 UTC
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r67120 | martin.v.loewis | 2008-11-06 17:43:00 +0100 (Do, 06 Nov 2008) | 2 lines

  Issue #4120: Exclude manifest from extension modules in VS2008.
........
1 parent 10f3710
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