MCPcopy Create free account
hub / github.com/ValveSoftware/GameNetworkingSockets / V_strncmp

Function V_strncmp

src/vstdlib/strtools.cpp:39–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39int V_strncmp( const char *s1, const char *s2, int count )
40{
41 Assert( count >= 0 );
42 Assert( count == 0 || s1 != NULL );
43 Assert( count == 0 || s2 != NULL );
44
45 while ( count-- > 0 )
46 {
47 if ( *s1 != *s2 )
48 return *s1 < *s2 ? -1 : 1; // string different
49 if ( *s1 == '\0' )
50 return 0; // null terminator hit - strings the same
51 s1++;
52 s2++;
53 }
54
55 return 0; // count characters compared the same
56}
57
58//-----------------------------------------------------------------------------
59// Finds a string in another string with a case insensitive test w/ length validation

Callers 2

PeekStringMatchMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected