History

kdb: replace strnicmp with strncasecmp

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.

Rasmus Villemoes committed 12 years ago

Commit f9f2bac1 parent 484ac2f1 file · +3 −3Browse files

Showing the changes to kernel/debug (1 of 1 file). Show all

Unified · Split

kernel/debug/kdb/kdb_bp.c+3−3
@@ -52,11 +52,11 @@ static int kdb_parsebp(int argc, const char **argv, int *nextargp, kdb_bp_t *bp) · 51 unmodified lines
5252
5353 bp->bph_length = 1;
5454 if ((argc + 1) != nextarg) {
55− if (strnicmp(argv[nextarg], "datar", sizeof("datar")) == 0)
55+ if (strncasecmp(argv[nextarg], "datar", sizeof("datar")) == 0)
5656 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)
5858 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)
6060 bp->bp_type = BP_HARDWARE_BREAKPOINT;
6161 else
6262 return KDB_ARGCOUNT;