Skip to content

Commit 5caa347

Browse files
committed
Clean up most -Wunused-but-set-variable warnings from gcc 4.6
This warning is new in gcc 4.6 and part of -Wall. This patch cleans up most of the noise, but there are some still warnings that are trickier to remove.
1 parent 3c381a5 commit 5caa347

File tree

34 files changed

+64
-188
lines changed

34 files changed

+64
-188
lines changed

contrib/isn/isn.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,7 @@ ean2isn(ean13 ean, bool errorOK, ean13 *result, enum isn_type accept)
341341
enum isn_type type = INVALID;
342342

343343
char buf[MAXEAN13LEN + 1];
344-
char *firstdig,
345-
*aux;
344+
char *aux;
346345
unsigned digval;
347346
unsigned search;
348347
ean13 ret = ean;
@@ -354,7 +353,7 @@ ean2isn(ean13 ean, bool errorOK, ean13 *result, enum isn_type accept)
354353

355354
/* convert the number */
356355
search = 0;
357-
firstdig = aux = buf + 13;
356+
aux = buf + 13;
358357
*aux = '\0'; /* terminate string; aux points to last digit */
359358
do
360359
{
@@ -528,8 +527,7 @@ ean2string(ean13 ean, bool errorOK, char *result, bool shortType)
528527
const unsigned (*TABLE_index)[2];
529528
enum isn_type type = INVALID;
530529

531-
char *firstdig,
532-
*aux;
530+
char *aux;
533531
unsigned digval;
534532
unsigned search;
535533
char valid = '\0'; /* was the number initially written with a
@@ -546,7 +544,7 @@ ean2string(ean13 ean, bool errorOK, char *result, bool shortType)
546544

547545
/* convert the number */
548546
search = 0;
549-
firstdig = aux = result + MAXEAN13LEN;
547+
aux = result + MAXEAN13LEN;
550548
*aux = '\0'; /* terminate string; aux points to last digit */
551549
*--aux = valid; /* append '!' for numbers with invalid but
552550
* corrected check digit */

contrib/pageinspect/fsmfuncs.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ Datum
3535
fsm_page_contents(PG_FUNCTION_ARGS)
3636
{
3737
bytea *raw_page = PG_GETARG_BYTEA_P(0);
38-
int raw_page_size;
3938
StringInfoData sinfo;
4039
FSMPage fsmpage;
4140
int i;
@@ -45,7 +44,6 @@ fsm_page_contents(PG_FUNCTION_ARGS)
4544
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
4645
(errmsg("must be superuser to use raw page functions"))));
4746

48-
raw_page_size = VARSIZE(raw_page) - VARHDRSZ;
4947
fsmpage = (FSMPage) PageGetContents(VARDATA(raw_page));
5048

5149
initStringInfo(&sinfo);

contrib/pgcrypto/pgp-s2k.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,12 @@ static int
3939
calc_s2k_simple(PGP_S2K *s2k, PX_MD *md, const uint8 *key,
4040
unsigned key_len)
4141
{
42-
unsigned md_bs,
43-
md_rlen;
42+
unsigned md_rlen;
4443
uint8 buf[PGP_MAX_DIGEST];
4544
unsigned preload;
4645
unsigned remain;
4746
uint8 *dst = s2k->key;
4847

49-
md_bs = px_md_block_size(md);
5048
md_rlen = px_md_result_size(md);
5149

5250
remain = s2k->key_len;
@@ -83,14 +81,12 @@ calc_s2k_simple(PGP_S2K *s2k, PX_MD *md, const uint8 *key,
8381
static int
8482
calc_s2k_salted(PGP_S2K *s2k, PX_MD *md, const uint8 *key, unsigned key_len)
8583
{
86-
unsigned md_bs,
87-
md_rlen;
84+
unsigned md_rlen;
8885
uint8 buf[PGP_MAX_DIGEST];
8986
unsigned preload = 0;
9087
uint8 *dst;
9188
unsigned remain;
9289

93-
md_bs = px_md_block_size(md);
9490
md_rlen = px_md_result_size(md);
9591

9692
dst = s2k->key;
@@ -129,8 +125,7 @@ static int
129125
calc_s2k_iter_salted(PGP_S2K *s2k, PX_MD *md, const uint8 *key,
130126
unsigned key_len)
131127
{
132-
unsigned md_bs,
133-
md_rlen;
128+
unsigned md_rlen;
134129
uint8 buf[PGP_MAX_DIGEST];
135130
uint8 *dst;
136131
unsigned preload = 0;
@@ -143,7 +138,6 @@ calc_s2k_iter_salted(PGP_S2K *s2k, PX_MD *md, const uint8 *key,
143138
cval = s2k->iter;
144139
count = ((unsigned) 16 + (cval & 15)) << ((cval >> 4) + 6);
145140

146-
md_bs = px_md_block_size(md);
147141
md_rlen = px_md_result_size(md);
148142

149143
remain = s2k->key_len;

contrib/pgcrypto/px-hmac.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,11 @@ static void
5252
hmac_init(PX_HMAC *h, const uint8 *key, unsigned klen)
5353
{
5454
unsigned bs,
55-
hlen,
5655
i;
5756
uint8 *keybuf;
5857
PX_MD *md = h->md;
5958

6059
bs = px_md_block_size(md);
61-
hlen = px_md_result_size(md);
6260
keybuf = px_alloc(bs);
6361
memset(keybuf, 0, bs);
6462

contrib/pgcrypto/px.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,12 @@ combo_init(PX_Combo *cx, const uint8 *key, unsigned klen,
162162
const uint8 *iv, unsigned ivlen)
163163
{
164164
int err;
165-
unsigned bs,
166-
ks,
165+
unsigned ks,
167166
ivs;
168167
PX_Cipher *c = cx->cipher;
169168
uint8 *ivbuf = NULL;
170169
uint8 *keybuf;
171170

172-
bs = px_cipher_block_size(c);
173171
ks = px_cipher_key_size(c);
174172

175173
ivs = px_cipher_iv_size(c);
@@ -205,15 +203,13 @@ combo_encrypt(PX_Combo *cx, const uint8 *data, unsigned dlen,
205203
int err = 0;
206204
uint8 *bbuf;
207205
unsigned bs,
208-
maxlen,
209206
bpos,
210207
i,
211208
pad;
212209

213210
PX_Cipher *c = cx->cipher;
214211

215212
bbuf = NULL;
216-
maxlen = *rlen;
217213
bs = px_cipher_block_size(c);
218214

219215
/* encrypt */

contrib/seg/seg.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,6 @@ restore(char *result, float val, int n)
867867
'0', '0', '0', '0', '\0'
868868
};
869869
char *p;
870-
char *mant;
871870
int exp;
872871
int i,
873872
dp,
@@ -893,7 +892,7 @@ restore(char *result, float val, int n)
893892
*p = '\0';
894893

895894
/* get the exponent */
896-
mant = (char *) strtok(strdup(result), "e");
895+
strtok(strdup(result), "e");
897896
exp = atoi(strtok(NULL, "e"));
898897

899898
if (exp == 0)

src/backend/access/gist/gistvacuum.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ gistvacuumcleanup(PG_FUNCTION_ARGS)
3838
BlockNumber npages,
3939
blkno;
4040
BlockNumber totFreePages;
41-
BlockNumber lastBlock = GIST_ROOT_BLKNO,
42-
lastFilledBlock = GIST_ROOT_BLKNO;
4341
bool needLock;
4442

4543
/* No-op in ANALYZE ONLY mode */
@@ -90,11 +88,8 @@ gistvacuumcleanup(PG_FUNCTION_ARGS)
9088
totFreePages++;
9189
RecordFreeIndexPage(rel, blkno);
9290
}
93-
else
94-
lastFilledBlock = blkno;
9591
UnlockReleaseBuffer(buffer);
9692
}
97-
lastBlock = npages - 1;
9893

9994
/* Finally, vacuum the FSM */
10095
IndexFreeSpaceMapVacuum(info->index);

src/backend/access/nbtree/nbtpage.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,6 @@ _bt_log_reuse_page(Relation rel, BlockNumber blkno, TransactionId latestRemovedX
466466

467467
/* XLOG stuff */
468468
{
469-
XLogRecPtr recptr;
470469
XLogRecData rdata[1];
471470
xl_btree_reuse_page xlrec_reuse;
472471

@@ -478,7 +477,7 @@ _bt_log_reuse_page(Relation rel, BlockNumber blkno, TransactionId latestRemovedX
478477
rdata[0].buffer = InvalidBuffer;
479478
rdata[0].next = NULL;
480479

481-
recptr = XLogInsert(RM_BTREE_ID, XLOG_BTREE_REUSE_PAGE, rdata);
480+
XLogInsert(RM_BTREE_ID, XLOG_BTREE_REUSE_PAGE, rdata);
482481

483482
/*
484483
* We don't do PageSetLSN or PageSetTLI here because we're about

src/backend/catalog/pg_proc.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,6 @@ fmgr_internal_validator(PG_FUNCTION_ARGS)
671671
{
672672
Oid funcoid = PG_GETARG_OID(0);
673673
HeapTuple tuple;
674-
Form_pg_proc proc;
675674
bool isnull;
676675
Datum tmp;
677676
char *prosrc;
@@ -684,7 +683,6 @@ fmgr_internal_validator(PG_FUNCTION_ARGS)
684683
tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
685684
if (!HeapTupleIsValid(tuple))
686685
elog(ERROR, "cache lookup failed for function %u", funcoid);
687-
proc = (Form_pg_proc) GETSTRUCT(tuple);
688686

689687
tmp = SysCacheGetAttr(PROCOID, tuple, Anum_pg_proc_prosrc, &isnull);
690688
if (isnull)
@@ -717,7 +715,6 @@ fmgr_c_validator(PG_FUNCTION_ARGS)
717715
Oid funcoid = PG_GETARG_OID(0);
718716
void *libraryhandle;
719717
HeapTuple tuple;
720-
Form_pg_proc proc;
721718
bool isnull;
722719
Datum tmp;
723720
char *prosrc;
@@ -732,7 +729,6 @@ fmgr_c_validator(PG_FUNCTION_ARGS)
732729
tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
733730
if (!HeapTupleIsValid(tuple))
734731
elog(ERROR, "cache lookup failed for function %u", funcoid);
735-
proc = (Form_pg_proc) GETSTRUCT(tuple);
736732

737733
tmp = SysCacheGetAttr(PROCOID, tuple, Anum_pg_proc_prosrc, &isnull);
738734
if (isnull)

src/backend/catalog/toasting.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid, Datum reloptio
118118
Relation toast_rel;
119119
Relation class_rel;
120120
Oid toast_relid;
121-
Oid toast_idxid;
122121
Oid toast_typid = InvalidOid;
123122
Oid namespaceid;
124123
char toast_relname[NAMEDATALEN];
@@ -274,7 +273,7 @@ create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid, Datum reloptio
274273
coloptions[0] = 0;
275274
coloptions[1] = 0;
276275

277-
toast_idxid = index_create(toast_rel, toast_idxname, toastIndexOid,
276+
index_create(toast_rel, toast_idxname, toastIndexOid,
278277
indexInfo,
279278
list_make2("chunk_id", "chunk_seq"),
280279
BTREE_AM_OID,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy