1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-08 06:02:22 +03:00

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.
This commit is contained in:
Peter Eisentraut
2011-04-11 22:28:45 +03:00
parent 3c381a55b0
commit 5caa3479c2
34 changed files with 64 additions and 188 deletions

View File

@@ -341,8 +341,7 @@ ean2isn(ean13 ean, bool errorOK, ean13 *result, enum isn_type accept)
enum isn_type type = INVALID;
char buf[MAXEAN13LEN + 1];
char *firstdig,
*aux;
char *aux;
unsigned digval;
unsigned search;
ean13 ret = ean;
@@ -354,7 +353,7 @@ ean2isn(ean13 ean, bool errorOK, ean13 *result, enum isn_type accept)
/* convert the number */
search = 0;
firstdig = aux = buf + 13;
aux = buf + 13;
*aux = '\0'; /* terminate string; aux points to last digit */
do
{
@@ -528,8 +527,7 @@ ean2string(ean13 ean, bool errorOK, char *result, bool shortType)
const unsigned (*TABLE_index)[2];
enum isn_type type = INVALID;
char *firstdig,
*aux;
char *aux;
unsigned digval;
unsigned search;
char valid = '\0'; /* was the number initially written with a
@@ -546,7 +544,7 @@ ean2string(ean13 ean, bool errorOK, char *result, bool shortType)
/* convert the number */
search = 0;
firstdig = aux = result + MAXEAN13LEN;
aux = result + MAXEAN13LEN;
*aux = '\0'; /* terminate string; aux points to last digit */
*--aux = valid; /* append '!' for numbers with invalid but
* corrected check digit */

View File

@@ -35,7 +35,6 @@ Datum
fsm_page_contents(PG_FUNCTION_ARGS)
{
bytea *raw_page = PG_GETARG_BYTEA_P(0);
int raw_page_size;
StringInfoData sinfo;
FSMPage fsmpage;
int i;
@@ -45,7 +44,6 @@ fsm_page_contents(PG_FUNCTION_ARGS)
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
(errmsg("must be superuser to use raw page functions"))));
raw_page_size = VARSIZE(raw_page) - VARHDRSZ;
fsmpage = (FSMPage) PageGetContents(VARDATA(raw_page));
initStringInfo(&sinfo);

View File

@@ -39,14 +39,12 @@ static int
calc_s2k_simple(PGP_S2K *s2k, PX_MD *md, const uint8 *key,
unsigned key_len)
{
unsigned md_bs,
md_rlen;
unsigned md_rlen;
uint8 buf[PGP_MAX_DIGEST];
unsigned preload;
unsigned remain;
uint8 *dst = s2k->key;
md_bs = px_md_block_size(md);
md_rlen = px_md_result_size(md);
remain = s2k->key_len;
@@ -83,14 +81,12 @@ calc_s2k_simple(PGP_S2K *s2k, PX_MD *md, const uint8 *key,
static int
calc_s2k_salted(PGP_S2K *s2k, PX_MD *md, const uint8 *key, unsigned key_len)
{
unsigned md_bs,
md_rlen;
unsigned md_rlen;
uint8 buf[PGP_MAX_DIGEST];
unsigned preload = 0;
uint8 *dst;
unsigned remain;
md_bs = px_md_block_size(md);
md_rlen = px_md_result_size(md);
dst = s2k->key;
@@ -129,8 +125,7 @@ static int
calc_s2k_iter_salted(PGP_S2K *s2k, PX_MD *md, const uint8 *key,
unsigned key_len)
{
unsigned md_bs,
md_rlen;
unsigned md_rlen;
uint8 buf[PGP_MAX_DIGEST];
uint8 *dst;
unsigned preload = 0;
@@ -143,7 +138,6 @@ calc_s2k_iter_salted(PGP_S2K *s2k, PX_MD *md, const uint8 *key,
cval = s2k->iter;
count = ((unsigned) 16 + (cval & 15)) << ((cval >> 4) + 6);
md_bs = px_md_block_size(md);
md_rlen = px_md_result_size(md);
remain = s2k->key_len;

View File

@@ -52,13 +52,11 @@ static void
hmac_init(PX_HMAC *h, const uint8 *key, unsigned klen)
{
unsigned bs,
hlen,
i;
uint8 *keybuf;
PX_MD *md = h->md;
bs = px_md_block_size(md);
hlen = px_md_result_size(md);
keybuf = px_alloc(bs);
memset(keybuf, 0, bs);

View File

@@ -162,14 +162,12 @@ combo_init(PX_Combo *cx, const uint8 *key, unsigned klen,
const uint8 *iv, unsigned ivlen)
{
int err;
unsigned bs,
ks,
unsigned ks,
ivs;
PX_Cipher *c = cx->cipher;
uint8 *ivbuf = NULL;
uint8 *keybuf;
bs = px_cipher_block_size(c);
ks = px_cipher_key_size(c);
ivs = px_cipher_iv_size(c);
@@ -205,7 +203,6 @@ combo_encrypt(PX_Combo *cx, const uint8 *data, unsigned dlen,
int err = 0;
uint8 *bbuf;
unsigned bs,
maxlen,
bpos,
i,
pad;
@@ -213,7 +210,6 @@ combo_encrypt(PX_Combo *cx, const uint8 *data, unsigned dlen,
PX_Cipher *c = cx->cipher;
bbuf = NULL;
maxlen = *rlen;
bs = px_cipher_block_size(c);
/* encrypt */

View File

@@ -867,7 +867,6 @@ restore(char *result, float val, int n)
'0', '0', '0', '0', '\0'
};
char *p;
char *mant;
int exp;
int i,
dp,
@@ -893,7 +892,7 @@ restore(char *result, float val, int n)
*p = '\0';
/* get the exponent */
mant = (char *) strtok(strdup(result), "e");
strtok(strdup(result), "e");
exp = atoi(strtok(NULL, "e"));
if (exp == 0)