[PATCH] dont use strlen() but the result from a prior sprintf()
From: Eric Dumazet <hidden>
Date: 2005-06-22 12:56:55
From: Eric Dumazet <hidden>
Date: 2005-06-22 12:56:55
Hi David Small patch to save an unecessary call to strlen() : sprintf() gave us the length, just trust it. Thank you Eric Dumazet diff -Nu linux-2.6.12-orig/net/socket.c linux-2.6.12/net/socket.c
--- linux-2.6.12-orig/net/socket.c 2005-06-22 14:47:56.000000000 +0200
+++ linux-2.6.12/net/socket.c 2005-06-22 14:49:22.000000000 +0200@@ -382,9 +382,8 @@ 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);