]> err.no Git - linux-2.6/commitdiff
[NET]: dont use strlen() but the result from a prior sprintf()
authorEric Dumazet <dada1@cosmosbay.com>
Wed, 22 Jun 2005 21:32:51 +0000 (14:32 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 22 Jun 2005 21:32:51 +0000 (14:32 -0700)
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>
net/socket.c

index 38729af09461f0be4db5aa89e88d53dab314d9ad..6f2a178819726b7b878aa22a6d79954b61c1e239 100644 (file)
@@ -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);