string: address performance concerns for strncmp()

This commit is contained in:
Alex Lyon
2018-03-09 13:19:35 -08:00
parent 3890ec58f0
commit 50f79e9a0e
4 changed files with 25 additions and 16 deletions
+15
View File
@@ -0,0 +1,15 @@
#include <string.h>
#include <stdio.h>
int main(int argc, char* argv[]) {
printf("%d\n", strncmp("a", "aa", 2));
printf("%d\n", strncmp("a", "", 2));
printf("%d\n", strncmp("\xFF", "\xFE", 2));
printf("%d\n", strncmp("", "\xFF", 1));
printf("%d\n", strncmp("a", "c", 1));
printf("%d\n", strncmp("a", "a", 2));
puts("test");
return 0;
}