aboutsummaryrefslogtreecommitdiff
path: root/fs/cifs
diff options
context:
space:
mode:
authorSteve French <smfrench@gmail.com>2012-11-29 18:07:51 -0600
committerSteve French <smfrench@gmail.com>2012-12-05 13:27:30 -0600
commit1cc9bd68617f2a92dcd6e4398288341d16cfb5c1 (patch)
tree21594cc37e9f39545b1ed29a7b9faa235ffba183 /fs/cifs
parentb979aaa1777259330435c47f900833dabe9189e8 (diff)
make convert_delimiter use strchr instead of open-coding it
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 <jlayton@redhat.com> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/cifsglob.h13
1 files changed, 4 insertions, 9 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 052d85b333f..74a07b604ff 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -1064,21 +1064,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;
}
#ifdef CONFIG_CIFS_STATS