From patchwork Tue Sep 16 20:51:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 390191 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id E46A5140111 for ; Wed, 17 Sep 2014 06:57:29 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755307AbaIPUwL (ORCPT ); Tue, 16 Sep 2014 16:52:11 -0400 Received: from mail-lb0-f172.google.com ([209.85.217.172]:36906 "EHLO mail-lb0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755244AbaIPUwH (ORCPT ); Tue, 16 Sep 2014 16:52:07 -0400 Received: by mail-lb0-f172.google.com with SMTP id w7so614154lbi.3 for ; Tue, 16 Sep 2014 13:52:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jl5lxak90m9+I6kfxtFRBuSWHiHjgvkkPDIkR33AYko=; b=bcgt41wV5cbgKeVyq8MwMNH3JGYtGAK9mNjwH1t8Qarc4vHZiMCfyF81Y3z0ZtrnYi MtwIFrRT6feg/+nxezfwY+Ywj86VTVH+N58vPSJRmreqI8MnmHFkp/ffGAKRk235/rpS 8sAcPqp7qb3mUD4I2JR2NauqxcNVFt7UrWtqI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jl5lxak90m9+I6kfxtFRBuSWHiHjgvkkPDIkR33AYko=; b=aw1EEGqul+8sOEni0KLEbuSmpWay1pBX2DQOEBiwt6KbJjQHTgtIYBhJFulvlYKMQX WYtoEZeaWtxXg6lYSA73jsDURoko3/UHWG8/IzbVE2xPVTA2GFz6GTEjW6eCAGJg3jbl lwjpM7KK2GydMnsGKOjj9w8Fzk7be7+Pa697MCJsQLn6BId3ihSrS0Z93skqvMvuo0O6 F6owlLF4WgwITE9gPA/lFqFt3bnBw9o+tWgnDrUpC62zOG4U6v0Jcz/VTto9KTTl4JY6 HpB/bUaWByVi2PKkxNH0hhMZQM6lC2Q3EBYj5WRjBCo59t32dCxmb7Dupa4HE4Z5Ep39 lvmw== X-Gm-Message-State: ALoCoQlxRDQj44rzUoYVN8Ik09NYKqrkNlm8jrF0t+WOAjQ6c1FeKCwuAvWCwSK+9BX4CVItpr+g X-Received: by 10.112.155.163 with SMTP id vx3mr5604267lbb.70.1410900726224; Tue, 16 Sep 2014 13:52:06 -0700 (PDT) Received: from spencer.imf.au.dk ([130.225.20.51]) by mx.google.com with ESMTPSA id nb7sm5514091lbb.43.2014.09.16.13.52.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Sep 2014 13:52:05 -0700 (PDT) From: Rasmus Villemoes To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Rasmus Villemoes , Marek Lindner , b.a.t.m.a.n@lists.open-mesh.org, netdev@vger.kernel.org Subject: [PATCH 09/22] batman-adv: Replace strnicmp with strncasecmp Date: Tue, 16 Sep 2014 22:51:23 +0200 Message-Id: <1410900696-6481-10-git-send-email-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.0.4 In-Reply-To: <1410900696-6481-1-git-send-email-linux@rasmusvillemoes.dk> References: <1410900696-6481-1-git-send-email-linux@rasmusvillemoes.dk> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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. Cc: Marek Lindner Cc: b.a.t.m.a.n@lists.open-mesh.org Cc: netdev@vger.kernel.org Signed-off-by: Rasmus Villemoes Acked-by: Antonio Quartulli --- net/batman-adv/gateway_common.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/batman-adv/gateway_common.c b/net/batman-adv/gateway_common.c index 6f5e621..88a1bc3 100644 --- a/net/batman-adv/gateway_common.c +++ b/net/batman-adv/gateway_common.c @@ -44,10 +44,10 @@ static bool batadv_parse_gw_bandwidth(struct net_device *net_dev, char *buff, if (strlen(buff) > 4) { tmp_ptr = buff + strlen(buff) - 4; - if (strnicmp(tmp_ptr, "mbit", 4) == 0) + if (strncasecmp(tmp_ptr, "mbit", 4) == 0) bw_unit_type = BATADV_BW_UNIT_MBIT; - if ((strnicmp(tmp_ptr, "kbit", 4) == 0) || + if ((strncasecmp(tmp_ptr, "kbit", 4) == 0) || (bw_unit_type == BATADV_BW_UNIT_MBIT)) *tmp_ptr = '\0'; } @@ -77,10 +77,10 @@ static bool batadv_parse_gw_bandwidth(struct net_device *net_dev, char *buff, if (strlen(slash_ptr + 1) > 4) { tmp_ptr = slash_ptr + 1 - 4 + strlen(slash_ptr + 1); - if (strnicmp(tmp_ptr, "mbit", 4) == 0) + if (strncasecmp(tmp_ptr, "mbit", 4) == 0) bw_unit_type = BATADV_BW_UNIT_MBIT; - if ((strnicmp(tmp_ptr, "kbit", 4) == 0) || + if ((strncasecmp(tmp_ptr, "kbit", 4) == 0) || (bw_unit_type == BATADV_BW_UNIT_MBIT)) *tmp_ptr = '\0'; }