Commit b7a8d756fb8080ab6ba9f4a9d4056a1056245fbc

Authored by Rasmus Villemoes
Committed by Linus Torvalds
1 parent a97df4277d

batman-adv: 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.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Marek Lindner <mareklindner@neomailbox.ch>
Acked-by: Antonio Quartulli <antonio@meshcoding.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 4 additions and 4 deletions Side-by-side Diff

net/batman-adv/gateway_common.c
... ... @@ -44,10 +44,10 @@
44 44 if (strlen(buff) > 4) {
45 45 tmp_ptr = buff + strlen(buff) - 4;
46 46  
47   - if (strnicmp(tmp_ptr, "mbit", 4) == 0)
  47 + if (strncasecmp(tmp_ptr, "mbit", 4) == 0)
48 48 bw_unit_type = BATADV_BW_UNIT_MBIT;
49 49  
50   - if ((strnicmp(tmp_ptr, "kbit", 4) == 0) ||
  50 + if ((strncasecmp(tmp_ptr, "kbit", 4) == 0) ||
51 51 (bw_unit_type == BATADV_BW_UNIT_MBIT))
52 52 *tmp_ptr = '\0';
53 53 }
54 54  
... ... @@ -77,10 +77,10 @@
77 77 if (strlen(slash_ptr + 1) > 4) {
78 78 tmp_ptr = slash_ptr + 1 - 4 + strlen(slash_ptr + 1);
79 79  
80   - if (strnicmp(tmp_ptr, "mbit", 4) == 0)
  80 + if (strncasecmp(tmp_ptr, "mbit", 4) == 0)
81 81 bw_unit_type = BATADV_BW_UNIT_MBIT;
82 82  
83   - if ((strnicmp(tmp_ptr, "kbit", 4) == 0) ||
  83 + if ((strncasecmp(tmp_ptr, "kbit", 4) == 0) ||
84 84 (bw_unit_type == BATADV_BW_UNIT_MBIT))
85 85 *tmp_ptr = '\0';
86 86 }