| 37 | } |
| 38 | |
| 39 | int 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 |
no outgoing calls
no test coverage detected