lkml.org 
[lkml]   [2002]   [Aug]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[patch] 2.4.19 Generate better code for nfs_sillyrename
Date
Using strlen() generates an unnecessary inline function expansion plus
dynamic stack adjustment. For constant strings, strlen() == sizeof()-1
and the object code is better. Patch against 2.4.19.

diff -urp 2.4.x-xfs-linux/fs/nfs/dir.c 2.4.x-xfs-linux-kdb/fs/nfs/dir.c
--- 2.4.x-xfs-linux/fs/nfs/dir.c Fri Aug 9 16:03:57 2002
+++ 2.4.x-xfs-linux-kdb/fs/nfs/dir.c Wed Aug 28 16:54:44 2002
@@ -741,7 +741,7 @@ static int nfs_sillyrename(struct inode
static unsigned int sillycounter;
const int i_inosize = sizeof(dir->i_ino)*2;
const int countersize = sizeof(sillycounter)*2;
- const int slen = strlen(".nfs") + i_inosize + countersize;
+ const int slen = sizeof(".nfs")-1 + i_inosize + countersize;
char silly[slen+1];
struct qstr qsilly;
struct dentry *sdentry;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:28    [W:0.033 / U:28.884 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site