Przeglądaj źródła

[NET]: dont use strlen() but the result from a prior sprintf()

Small patch to save an unecessary call to strlen() : sprintf() gave us
the length, just trust it.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Eric Dumazet 20 lat temu
rodzic
commit
f31f5f0512
1 zmienionych plików z 1 dodań i 2 usunięć
  1. 1 2
      net/socket.c

+ 1 - 2
net/socket.c

@@ -383,9 +383,8 @@ int sock_map_fd(struct socket *sock)
 			goto out;
 			goto out;
 		}
 		}
 
 
-		sprintf(name, "[%lu]", SOCK_INODE(sock)->i_ino);
+		this.len = sprintf(name, "[%lu]", SOCK_INODE(sock)->i_ino);
 		this.name = name;
 		this.name = name;
-		this.len = strlen(name);
 		this.hash = SOCK_INODE(sock)->i_ino;
 		this.hash = SOCK_INODE(sock)->i_ino;
 
 
 		file->f_dentry = d_alloc(sock_mnt->mnt_sb->s_root, &this);
 		file->f_dentry = d_alloc(sock_mnt->mnt_sb->s_root, &this);