pgsql: In bms_add_member(), use repalloc() if the bms needs to be enlar

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: In bms_add_member(), use repalloc() if the bms needs to be enlar
Date: 2013-09-30 13:56:10
Message-ID: E1VQdxK-0005YC-I9@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

In bms_add_member(), use repalloc() if the bms needs to be enlarged.

Previously bms_add_member() would palloc a whole-new copy of the existing
set, copy the words, and pfree the old one. repalloc() is potentially much
faster, and more importantly, this is less surprising if CurrentMemoryContext
is not the same as the context the old set is in. bms_add_member() still
allocates a new bitmapset in CurrentMemoryContext if NULL is passed as
argument, but that is a lot less likely to induce bugs.

Nicholas White.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/ee01d848f39400c8524c66944ada6fde47894978

Modified Files
--------------
src/backend/nodes/bitmapset.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andrew Dunstan 2013-09-30 14:18:50 pgsql: Ensure installation dirs are built before contents are installed
Previous Message Heikki Linnakangas 2013-09-30 10:05:57 pgsql: Fix snapshot leak if lo_open called on non-existent object.