The kernel used to contain two functions for length-delimited, case-insensitive string comparison, strnicmp with correct semantics and a slightly buggy strncasecmp. The latter is the POSIX name, so strnicmp was renamed to strncasecmp, and strnicmp made into a wrapper for the new strncasecmp to avoid breaking existing users. To allow the compat wrapper strnicmp to be removed at some point in the future, and to avoid the extra indirection cost, do s/strnicmp/strncasecmp/g.
Showing the changes to kernel/debug (1 of 1 file). Show all
Unified · Split
| @@ -52,11 +52,11 @@ static int kdb_parsebp(int argc, const char **argv, int *nextargp, kdb_bp_t *bp) · 51 unmodified lines | ||
| 52 | 52 | |
| 53 | 53 | bp->bph_length = 1; |
| 54 | 54 | if ((argc + 1) != nextarg) { |
| 55 | − if (strnicmp(argv[nextarg], "datar", sizeof("datar")) == 0) | |
| 55 | + if (strncasecmp(argv[nextarg], "datar", sizeof("datar")) == 0) | |
| 56 | 56 | bp->bp_type = BP_ACCESS_WATCHPOINT; |
| 57 | − else if (strnicmp(argv[nextarg], "dataw", sizeof("dataw")) == 0) | |
| 57 | + else if (strncasecmp(argv[nextarg], "dataw", sizeof("dataw")) == 0) | |
| 58 | 58 | bp->bp_type = BP_WRITE_WATCHPOINT; |
| 59 | − else if (strnicmp(argv[nextarg], "inst", sizeof("inst")) == 0) | |
| 59 | + else if (strncasecmp(argv[nextarg], "inst", sizeof("inst")) == 0) | |
| 60 | 60 | bp->bp_type = BP_HARDWARE_BREAKPOINT; |
| 61 | 61 | else |
| 62 | 62 | return KDB_ARGCOUNT; |