libafscp: Move server lookup inside AFSCP_DEBUG
authorSimon Wilkinson <sxw@your-file-system.com>
Tue, 19 Feb 2013 17:46:04 +0000 (17:46 +0000)
committerDerrick Brashear <shadow@your-file-system.com>
Fri, 22 Feb 2013 21:03:39 +0000 (13:03 -0800)
We only use the results of the server lookup when AFSCP_DEBUG
is defined, so only bother actually doing the lookup when that
is set.

Caught by clang-analyzer

Change-Id: If79177e9d06817592b0630db7050cf3d40f3ee5f
Reviewed-on: http://gerrit.openafs.org/9197
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

src/libafscp/afscp_volume.c

index 55421b2..50495d2 100644 (file)
@@ -171,8 +171,8 @@ afscp_VolumeByName(struct afscp_cell *cell, const char *vname,
     }
 
     ret->voltype = intype;
-    server = afscp_ServerByIndex(ret->servers[0]);
 #ifdef AFSCP_DEBUG
+    server = afscp_ServerByIndex(ret->servers[0]);
     if (server != NULL)
        i.s_addr = server->addrs[0];
     else
@@ -313,8 +313,8 @@ afscp_VolumeById(struct afscp_cell *cell, afs_uint32 id)
        break;
     }
     ret->voltype = voltype;
-    server = afscp_ServerByIndex(ret->servers[0]);
 #ifdef AFSCP_DEBUG
+    server = afscp_ServerByIndex(ret->servers[0]);
     if (server)
        i.s_addr = server->addrs[0];
     else