diff options
author | Steve French <smfrench@gmail.com> | 2012-11-29 19:07:51 -0500 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2012-12-05 14:27:30 -0500 |
commit | 1cc9bd68617f2a92dcd6e4398288341d16cfb5c1 (patch) | |
tree | 21594cc37e9f39545b1ed29a7b9faa235ffba183 /fs/cifs | |
parent | b979aaa1777259330435c47f900833dabe9189e8 (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.h | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 052d85b333f3..74a07b604ffd 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) | |||
1064 | static inline void | 1064 | static inline void |
1065 | convert_delimiter(char *path, char delim) | 1065 | convert_delimiter(char *path, char delim) |
1066 | { | 1066 | { |
1067 | int i; | 1067 | char old_delim, *pos; |
1068 | char old_delim; | ||
1069 | |||
1070 | if (path == NULL) | ||
1071 | return; | ||
1072 | 1068 | ||
1073 | if (delim == '/') | 1069 | if (delim == '/') |
1074 | old_delim = '\\'; | 1070 | old_delim = '\\'; |
1075 | else | 1071 | else |
1076 | old_delim = '/'; | 1072 | old_delim = '/'; |
1077 | 1073 | ||
1078 | for (i = 0; path[i] != '\0'; i++) { | 1074 | pos = path; |
1079 | if (path[i] == old_delim) | 1075 | while ((pos = strchr(pos, old_delim))) |
1080 | path[i] = delim; | 1076 | *pos = delim; |
1081 | } | ||
1082 | } | 1077 | } |
1083 | 1078 | ||
1084 | #ifdef CONFIG_CIFS_STATS | 1079 | #ifdef CONFIG_CIFS_STATS |