cellconfig: move memcpy outside loop
authorPerry Ruiter <pruiter@sinenomine.net>
Thu, 6 Mar 2014 05:53:16 +0000 (21:53 -0800)
committerJeffrey Altman <jaltman@your-file-system.com>
Tue, 11 Mar 2014 13:24:19 +0000 (06:24 -0700)
memcpy only needs to be done once prior to each entry into loop,
so move it outside the loop.

Change-Id: I68c09b240756f830b1a4dc9b8a338916f91cd7b2
Reviewed-on: http://gerrit.openafs.org/10872
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/auth/cellconfig.c

index 9ff4082..11c51cd 100644 (file)
@@ -1414,9 +1414,9 @@ afsconf_GetCellInfo(struct afsconf_dir *adir, char *acellName, char *aservice,
                     for (i=0 ; he->h_addr_list[i] && numServers < MAXHOSTSPERCELL; i++) {
                         /* check to see if this is a new address; if so insert it into the list */
                         int k, dup;
+                       afs_uint32 addr;
+                       memcpy(&addr, he->h_addr_list[i], sizeof(addr));
                         for (k=0, dup=0; !dup && k < numServers; k++) {
-                           afs_uint32 addr;
-                           memcpy(&addr, he->h_addr_list[i], sizeof(addr));
                             if (hostAddr[k].sin_addr.s_addr == addr) {
                                 dup = 1;
                            }