public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3, 12/16] xfsprogs: metadump: no need for local copy of name when obfuscating
@ 2011-02-18 21:21 Alex Elder
  2011-02-24  2:04 ` Dave Chinner
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Elder @ 2011-02-18 21:21 UTC (permalink / raw)
  To: xfs

The local "newname" buffer in obfuscate_name() is used to hold
an obfuscated name as it gets generated.  But it is always copied
back into the passed-in name buffer, so we might as well just use
the name buffer passed directly and avoid the copy.

Signed-off-by: Alex Elder <aelder@sgi.com>

This is a new change, not posted with this series previously.

---
 db/metadump.c |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

Index: b/db/metadump.c
===================================================================
--- a/db/metadump.c
+++ b/db/metadump.c
@@ -479,8 +479,7 @@ obfuscate_name(
 	size_t		name_len,
 	uchar_t		*name)
 {
-	uchar_t		newname[NAME_MAX];
-	uchar_t		*newp = newname;
+	uchar_t		*newp = name;
 	int		i;
 	xfs_dahash_t	new_hash = 0;
 	uchar_t		*first;
@@ -540,11 +539,7 @@ obfuscate_name(
 		*first ^= 0x10;
 		ASSERT(!is_invalid_char(*first));
 	}
-	ASSERT(libxfs_da_hashname(newname, name_len) == hash);
-
-	/* Copy the fully obfuscated name back to the caller's buffer */
-
-	memcpy(name, newname, name_len);
+	ASSERT(libxfs_da_hashname(name, name_len) == hash);
 }
 
 static void

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-24  2:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-18 21:21 [PATCH v3, 12/16] xfsprogs: metadump: no need for local copy of name when obfuscating Alex Elder
2011-02-24  2:04 ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox