From: Marc Dionne Date: Sat, 11 Sep 2010 17:23:11 +0000 (-0400) Subject: butc: Set but unused variables X-Git-Tag: openafs-devel-1_5_78~144 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=33139547312eb8e70650ba02034fc21d52e53ab2;p=packages%2Fo%2Fopenafs.git butc: Set but unused variables 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 Reviewed-by: Derrick Brashear (cherry picked from commit f1796b0f4ad0202ad32e06bb849f443984cf22b5) Reviewed-on: http://gerrit.openafs.org/2798 Tested-by: Derrick Brashear --- diff --git a/src/butc/read_tape.c b/src/butc/read_tape.c index 9fc92d467..a4856592b 100644 --- a/src/butc/read_tape.c +++ b/src/butc/read_tape.c @@ -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; diff --git a/src/butc/tcudbprocs.c b/src/butc/tcudbprocs.c index a9ea47f68..5ccf654f7 100644 --- a/src/butc/tcudbprocs.c +++ b/src/butc/tcudbprocs.c @@ -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 =