]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
butc: Set but unused variables
authorMarc Dionne <marc.c.dionne@gmail.com>
Sat, 11 Sep 2010 17:23:11 +0000 (13:23 -0400)
committerDerrick Brashear <shadow@dementia.org>
Mon, 20 Sep 2010 05:32:01 +0000 (22:32 -0700)
Remove unused variable taskId

writeData() systematically returns 0, so make it void and adapt
call sites that assigned the return value but never used it.
Also move the function up in the file to avoid the need for a
forward declaration, and make it static since it's only used here.

Spotted by gcc 4.6

Change-Id: I2f61c0395796498175f2cb9131066b00657f99a7
Reviewed-on: http://gerrit.openafs.org/2785
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
src/butc/read_tape.c
src/butc/tcudbprocs.c

index 9fc92d46761a0cfdb093d0026796a67fa8af5975..a4856592b78d7a1e28573ae4db948b837b9513c8 100644 (file)
@@ -48,9 +48,6 @@ struct fileMark {             /* also in file_tm.c */
     afs_uint32 nBytes;
 };
 
-/* Forward declarations */
-int writeData(char *data, afs_int32 size);
-
 /* Read a tape block of size 16K */
 afs_int32
 readblock(char *buffer)
@@ -284,10 +281,25 @@ openOutFile(struct volumeHeader *headerPtr)
     return 0;
 }
 
+static void
+writeData(char *data, afs_int32 size)
+{
+    int rc;
+    u_int nwritten;
+
+    if (!ofdIsOpen)
+       return;
+    rc = USD_WRITE(ofd, data, (u_int) size, &nwritten);
+    if (rc != 0) {
+       fprintf(stderr, "Unable to write volume data to file. Code = %d\n",
+               rc);
+    }
+    return;
+}
+
 int
 writeLastBlocks(char *lastblock, char *lastblock2)
 {
-    int rc;
     char trailer[12];
     struct blockMark *bmark, *bmark2;
     char *data;
@@ -349,10 +361,10 @@ writeLastBlocks(char *lastblock, char *lastblock2)
        fprintf(stderr, "Failed to strip off volume trailer (2).\n");
     } else {
        if (count2 - tlen > 0) {
-           rc = writeData(data2, count2 - tlen);
+           writeData(data2, count2 - tlen);
        }
        if ((tlen == 0) && (count > 12 - pos)) {
-           rc = writeData(data, count - (12 - pos));
+           writeData(data, count - (12 - pos));
        }
     }
     return 0;
@@ -372,22 +384,6 @@ closeOutFile(void)
     return 0;
 }
 
-int
-writeData(char *data, afs_int32 size)
-{
-    int rc;
-    u_int nwritten;
-
-    if (!ofdIsOpen)
-       return 0;
-    rc = USD_WRITE(ofd, data, (u_int) size, &nwritten);
-    if (rc != 0) {
-       fprintf(stderr, "Unable to write volume data to file. Code = %d\n",
-               rc);
-    }
-    return 0;
-}
-
 static int
 WorkerBee(struct cmd_syndesc *as, void *arock)
 {
@@ -479,7 +475,7 @@ WorkerBee(struct cmd_syndesc *as, void *arock)
                if (lastblock2 != NULL) {
                    data = &lastblock2[sizeof(struct blockMark)];
                    bmark = (struct blockMark *)lastblock2;
-                   code = writeData(data, ntohl(bmark->count));
+                   writeData(data, ntohl(bmark->count));
                    tblock = lastblock2;
                } else if (lastblock != NULL) {
                    tblock = tapeblock2;
index a9ea47f68e1c219a9ba394220d36a531522b9391..5ccf654f7e9b4e1a25e5592869bd861c2c2cee32 100644 (file)
@@ -1221,14 +1221,11 @@ restoreDbDump(struct butm_tapeInfo *tapeInfo,
     struct budb_tapeEntry netTapeEntry, hostTapeEntry;
     struct budb_volumeEntry netVolumeEntry, hostVolumeEntry;
     struct structDumpHeader netItemHeader;
-    afs_int32 taskId;
     int restoreThisDump = 1;
     afs_int32 code = 0;
 
     extern struct udbHandleS udbHandle;
 
-    taskId = rstTapeInfoPtr->taskId;
-
     /* read dump entry */
     memset(&netDumpEntry, 0, sizeof(netDumpEntry));
     code =