Skip to content

Commit

Permalink
[NET]: dont use strlen() but the result from a prior sprintf()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Jun 22, 2005
1 parent 6a17944 commit f31f5f0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions net/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f31f5f0

Please sign in to comment.