From: Eric Dumazet Date: Wed, 22 Jun 2005 21:32:51 +0000 (-0700) Subject: [NET]: dont use strlen() but the result from a prior sprintf() X-Git-Tag: v2.6.13-rc4~130^2~154^2~9 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=f31f5f051269746179b01017fc5e3dcf6b37c67e;p=linux-2.6-omap-h63xx.git [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 Signed-off-by: David S. Miller --- diff --git a/net/socket.c b/net/socket.c index 38729af0946..6f2a1788197 100644 --- a/net/socket.c +++ b/net/socket.c @@ -383,9 +383,8 @@ int sock_map_fd(struct socket *sock) goto out; } - sprintf(name, "[%lu]", SOCK_INODE(sock)->i_ino); + this.len = sprintf(name, "[%lu]", SOCK_INODE(sock)->i_ino); this.name = name; - this.len = strlen(name); this.hash = SOCK_INODE(sock)->i_ino; file->f_dentry = d_alloc(sock_mnt->mnt_sb->s_root, &this);