shithub: lwext4

Download patch

ref: 31219e3b9ed046551de6931c0705a04c4a1c5282
parent: 9e38c9b4920cf0add533c8b05a12fd8b6ba51e8b
author: gkostka <[email protected]>
date: Tue Oct 20 16:23:57 EDT 2015

Remove redundant code

--- a/lwext4/ext4.c
+++ b/lwext4/ext4.c
@@ -1843,9 +1843,8 @@
 
 	/*If the size of symlink is smaller than 60 bytes*/
 	if (size < sizeof(ref.inode->blocks)) {
-		char *content = (char *)ref.inode->blocks;
-		memset(content, 0, sizeof(ref.inode->blocks));
-		memcpy(content, buf, size);
+		memset(ref.inode->blocks, 0, sizeof(ref.inode->blocks));
+		memcpy(ref.inode->blocks, buf, size);
 		ext4_inode_clear_flag(ref.inode, EXT4_INODE_FLAG_EXTENTS);
 	} else {
 		ext4_fs_inode_blocks_init(&f->mp->fs, &ref);
@@ -1922,8 +1921,6 @@
 
 	if (!buf)
 		return EINVAL;
-
-	memset(buf, 0, sizeof(bufsize));
 
 	filetype = EXT4_DIRENTRY_SYMLINK;