From patchwork Fri Nov 16 17:36:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 1756731 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id D2B544005F for ; Fri, 16 Nov 2012 17:37:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752151Ab2KPRhJ (ORCPT ); Fri, 16 Nov 2012 12:37:09 -0500 Received: from mail-vc0-f174.google.com ([209.85.220.174]:47263 "EHLO mail-vc0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751837Ab2KPRhI (ORCPT ); Fri, 16 Nov 2012 12:37:08 -0500 Received: by mail-vc0-f174.google.com with SMTP id fk26so3086806vcb.19 for ; Fri, 16 Nov 2012 09:37:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=XoX89KbTbxzkJZFBC34ryd5EvPyk57m0ve5w70DXMik=; b=nyxUZ9bq8wdhQ4pdVWxbHZwuvQbnmULSvRo5LZZowjpmjZUh2enxBV1Fz9w+dqjlsP ziXf3sxLC6DceSYQhRa3TFj+kUNn73rubn1dJaDczouQQOG4dg9MYSwOKLUEq//YHm6f 7s23vTHxJC0rLf59xvkTIdTXYd301nh0XqlFuamSLzbqigQUW++IYSbAFg6/2JBdjeh2 NJEa2vCzWrhp+eR9nshFeQQBzu73ze6DuuB7Xz/sU0B9dUNnxXxPuTVOkzGga3EPoqXh jbjSJwCpE3pqN5UhA2lgG+yejl3/roDxlPQrtiW6K1VdRw+AUeLO9wWlz6HwtDlDWJMO XNjg== Received: by 10.58.162.130 with SMTP id ya2mr5573967veb.2.1353087428024; Fri, 16 Nov 2012 09:37:08 -0800 (PST) Received: from salusa.poochiereds.net (cpe-107-015-110-129.nc.res.rr.com. [107.15.110.129]) by mx.google.com with ESMTPS id u6sm1189621vdi.20.2012.11.16.09.37.06 (version=SSLv3 cipher=OTHER); Fri, 16 Nov 2012 09:37:07 -0800 (PST) From: Jeff Layton To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org, fsauter@innominate.com, almiller_1@yahoo.co.uk Subject: [PATCH 3/6] cifs: make convert_delimiter use strchr instead of open-coding it Date: Fri, 16 Nov 2012 12:36:51 -0500 Message-Id: <1353087414-32152-4-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1353087414-32152-1-git-send-email-jlayton@redhat.com> References: <1353087414-32152-1-git-send-email-jlayton@redhat.com> X-Gm-Message-State: ALoCoQmjKtRcIQ3w3LUbCZa84XWrS+AIAXlj7ViO7ikcHIhsd5eAoHP5T2D+SH/eeFg80+748FBZ Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Take advantage of accelerated strchr() on arches that support it. Also, no caller ever passes in a NULL pointer. Get rid of the unneeded NULL pointer check. Signed-off-by: Jeff Layton Reviewed-by: Pavel Shilovsky --- fs/cifs/cifsglob.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index b141c90..414d93b 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -1066,21 +1066,16 @@ static inline char CIFS_DIR_SEP(const struct cifs_sb_info *cifs_sb) static inline void convert_delimiter(char *path, char delim) { - int i; - char old_delim; - - if (path == NULL) - return; + char old_delim, *pos; if (delim == '/') old_delim = '\\'; else old_delim = '/'; - for (i = 0; path[i] != '\0'; i++) { - if (path[i] == old_delim) - path[i] = delim; - } + pos = path; + while ((pos = strchr(pos, old_delim))) + *pos = delim; } static inline char *