Unused variable in hashpage.c - Mailing list pgsql-hackers

From Petr Jelinek
Subject Unused variable in hashpage.c
Date
Msg-id 551DD4C4.70107@2ndquadrant.com
Whole thread Raw
Responses Re: Unused variable in hashpage.c
List pgsql-hackers
Hi,

my compiler complains about unused variable nblkno in _hash_splitbucket
in no-assert build. It looks like relic of commit ed9cc2b5d which
removed the only use of that variable besides the Assert.

Looking at the code:
    nblkno = start_nblkno;
    Assert(nblkno == BufferGetBlockNumber(nbuf));

I was originally thinking of simply changing the Assert to use
start_nblkno but then I noticed that the start_nblkno is actually not
used anywhere in the function either (it's one of input parameters). And
given that the only caller of that function is getting the variable it
sends as nbuf to that function via start_nblkno, I think the Assert is
somewhat pointless there anyway.

So best way to solve this seems to be removing the start_nblkno from the
_hash_splitbucket altogether. Attached patch does just that.

--
  Petr Jelinek                  http://www.2ndQuadrant.com/
  PostgreSQL Development, 24x7 Support, Training & Services

Attachment

pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Re: Abbreviated keys for Datum tuplesort
Next
From: Alvaro Herrera
Date:
Subject: Re: Table-level log_autovacuum_min_duration