FreeBSD/lib/libpmc/libpmc.c
/*
 * Match an event name `name' with its canonical form.
 *
 * Matches are case insensitive and spaces, periods, underscores and
 * hyphen characters are considered to match each other.
 *
 * Returns 1 for a match, 0 otherwise.
 */
Match an event name `name' with its canonical form.
Matches are case insensitive and spaces, periods, underscores and
hyphen characters are considered to match each other.

Returns 1 for a match, 0 otherwise.
Match an event name ` name ' with its canonical form . Matches are case insensitive and spaces periods underscores and hyphen characters are considered to match each other . Returns 1 for a match 0 otherwise .
static int
pmc_match_event_name(const char *name, const char *canonicalname)
{
	int cc, nc;
	const unsigned char *c, *n;
	c = (const unsigned char *) canonicalname;
	n = (const unsigned char *) name;
	for (; (nc = *n) && (cc = *c); n++, c++) {
		if ((nc == ' ' || nc == '_' || nc == '-' || nc == '.') &&
		    (cc == ' ' || cc == '_' || cc == '-' || cc == '.'))
			continue;
		if (toupper(nc) == toupper(cc))
			continue;
		return (0);
	}
	if (*n == '\0' && *c == '\0')
		return (1);
	return (0);
}
static int pmc_match_event_name ( const char * name , const char * canonicalname ) { int cc , nc ; const unsigned char * c , * n ; c = ( const unsigned char * ) canonicalname ; n = ( const unsigned char * ) name ; for ( ; ( nc = * n ) && ( cc = * c ) ; n ++ , c ++ ) { if ( ( nc == ' ' || nc == ' ' || nc == ' ' || nc == ' ' ) && ( cc == ' ' || cc == ' ' || cc == ' ' || cc == ' ' ) ) continue ; if ( toupper ( nc ) == toupper ( cc ) ) continue ; return ( 0 ) ; } if ( * n == ' \0 ' && * c == ' \0 ' ) return ( 1 ) ; return ( 0 ) ; }
Match an event name `name' with its canonical form.
Match an event name ` name ' with its canonical form .