mirror of
https://github.com/ipxe/ipxe
synced 2026-01-23 04:29:01 +03:00
[libc] Fix strcmp()/strncmp() to return proper values
Fix strcmp() and strncmp() to return proper standard positive/negative values for unequal strings. Current implementation is backwards (i.e. the functions are returning negative when should be positive and vice-versa). Currently all consumers of these functions only check the return value for ==0 or !=0 and so we can safely change the implementation without breaking things. Signed-off-by: Aaron Young <Aaron.Young@oracle.com> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
committed by
Michael Brown
parent
e226fecd1b
commit
3946aa9bac
@@ -88,6 +88,7 @@ static void string_test_exec ( void ) {
|
||||
ok ( strcmp ( "Hello", "hello" ) != 0 );
|
||||
ok ( strcmp ( "Hello", "Hello world!" ) != 0 );
|
||||
ok ( strcmp ( "Hello world!", "Hello" ) != 0 );
|
||||
ok ( strcmp ( "abc", "def" ) < 0 );
|
||||
|
||||
/* Test strncmp() */
|
||||
ok ( strncmp ( "", "", 0 ) == 0 );
|
||||
|
||||
Reference in New Issue
Block a user