]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfsprogs: metadump: no need for local copy of name when obfuscating
authorAlex Elder <aelder@sgi.com>
Fri, 18 Feb 2011 21:21:02 +0000 (21:21 +0000)
committerAlex Elder <aelder@sgi.com>
Tue, 8 Mar 2011 18:04:40 +0000 (12:04 -0600)
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>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
db/metadump.c

index 5665abdcc3977e2d234d5f08f83906a1810bcb1a..fdbd835b23d74a168a5d7495ec366f7a67c3c0fb 100644 (file)
@@ -486,8 +486,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;
@@ -550,11 +549,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