aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/common/reloptions.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-05-24 22:22:44 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-05-24 22:22:44 +0000
commitc3707a4fcd0df0fb436d458a0e293215823e138c (patch)
tree292ecb5b2186dddbb66046f1808f7163b04bd725 /src/backend/access/common/reloptions.c
parentfc2660fc253ce871b2f26e7b6dce133092357cb0 (diff)
downloadpostgresql-c3707a4fcd0df0fb436d458a0e293215823e138c.tar.gz
postgresql-c3707a4fcd0df0fb436d458a0e293215823e138c.zip
Use more-portable coding for the check on handing out the last available
relopt_kind value in add_reloption_kind(). Per Zdenek Kotala.
Diffstat (limited to 'src/backend/access/common/reloptions.c')
-rw-r--r--src/backend/access/common/reloptions.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 37a546f909c..2668fd8bfe1 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/common/reloptions.c,v 1.26 2009/04/04 21:12:30 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/common/reloptions.c,v 1.27 2009/05/24 22:22:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -190,7 +190,7 @@ static relopt_string stringRelOpts[] =
};
static relopt_gen **relOpts = NULL;
-static bits32 last_assigned_kind = RELOPT_KIND_LAST_DEFAULT << 1;
+static bits32 last_assigned_kind = RELOPT_KIND_LAST_DEFAULT;
static int num_custom_options = 0;
static relopt_gen **custom_options = NULL;
@@ -278,17 +278,13 @@ initialize_reloptions(void)
relopt_kind
add_reloption_kind(void)
{
- relopt_kind kind;
-
- /* don't hand out the last bit so that the wraparound check is portable */
+ /* don't hand out the last bit so that the enum's behavior is portable */
if (last_assigned_kind >= RELOPT_KIND_MAX)
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("user-defined relation parameter types limit exceeded")));
-
- kind = (relopt_kind) last_assigned_kind;
last_assigned_kind <<= 1;
- return kind;
+ return (relopt_kind) last_assigned_kind;
}
/*