mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 19:29:37 +00:00
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>
This commit is contained in:
parent
b979aaa177
commit
1cc9bd6861
1 changed files with 4 additions and 9 deletions
|
@ -1064,21 +1064,16 @@ static inline char CIFS_DIR_SEP(const struct cifs_sb_info *cifs_sb)
|
||||||
static inline void
|
static inline void
|
||||||
convert_delimiter(char *path, char delim)
|
convert_delimiter(char *path, char delim)
|
||||||
{
|
{
|
||||||
int i;
|
char old_delim, *pos;
|
||||||
char old_delim;
|
|
||||||
|
|
||||||
if (path == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (delim == '/')
|
if (delim == '/')
|
||||||
old_delim = '\\';
|
old_delim = '\\';
|
||||||
else
|
else
|
||||||
old_delim = '/';
|
old_delim = '/';
|
||||||
|
|
||||||
for (i = 0; path[i] != '\0'; i++) {
|
pos = path;
|
||||||
if (path[i] == old_delim)
|
while ((pos = strchr(pos, old_delim)))
|
||||||
path[i] = delim;
|
*pos = delim;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_CIFS_STATS
|
#ifdef CONFIG_CIFS_STATS
|
||||||
|
|
Loading…
Reference in a new issue