pgsql: Change the way string relopts are allocated.

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Change the way string relopts are allocated.
Date: 2011-08-09 12:32:24
Message-ID: E1QqlTs-0006W3-Sw@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Change the way string relopts are allocated.

Don't try to allocate the default value for a string relopt in the same
palloc chunk as the relopt_string struct. That didn't work too well if you
added a built-in string relopt in the stringRelOpts array, as it's not
possible to have an initializer for a variable length struct in C. This
makes the code slightly simpler too.

While we're at it, move the call to validator function in
add_string_reloption to before the allocation, so that if someone does pass
a bogus default value, we don't leak memory.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/77949a2913b3cbaa7b2e2a73f014d541e251f18b

Modified Files
--------------
src/backend/access/common/reloptions.c | 39 +++++++++----------------------
src/include/access/reloptions.h | 2 +-
2 files changed, 13 insertions(+), 28 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2011-08-09 15:31:47 pgsql: Use clearer notation for getnameinfo() return handling
Previous Message Heikki Linnakangas 2011-08-09 08:46:43 pgsql: Fix grammar and spelling in log message.