[PATCH] ntfs: simplify ntfs_reparse_set_native_symlink()

Dmitry Antipov <[email protected]>
Newsgroups org.kernel.vger.linux-fsdevel
Message-ID <[email protected]>
Avoid redundant 'strlen()' and use the convenient 'strreplace()'
to simplify 'ntfs_reparse_set_native_symlink()'.

Signed-off-by: Dmitry Antipov <[email protected]>
---
 fs/ntfs/reparse.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/fs/ntfs/reparse.c b/fs/ntfs/reparse.c
index fa523dc3691e..1298cfc3a707 100644
--- a/fs/ntfs/reparse.c
+++ b/fs/ntfs/reparse.c
@@ -894,13 +894,7 @@ int ntfs_reparse_set_native_symlink(struct ntfs_inode *ni,
 
 	err = ntfs_set_ntfs_reparse_data(ni, (char *)reparse, total_reparse_len);
 	if (!err) {
-		int len = strlen(sub_name);
-
-		for (i = 0; i < len; i++) {
-			if (sub_name[i] == '\\')
-				sub_name[i] = '/';
-		}
-		ni->target = sub_name;
+		ni->target = strreplace(sub_name, '\\', '/');
 		sub_name = NULL;
 		if (prt_sub_shared)
 			prt_name = NULL;
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.