Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc3707a4

Browse files
committed
Use more-portable coding for the check on handing out the last available
relopt_kind value in add_reloption_kind(). Per Zdenek Kotala.
1 parentfc2660f commitc3707a4

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

‎src/backend/access/common/reloptions.c‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/common/reloptions.c,v 1.26 2009/04/04 21:12:30 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/common/reloptions.c,v 1.27 2009/05/24 22:22:44 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -190,7 +190,7 @@ static relopt_string stringRelOpts[] =
190190
};
191191

192192
staticrelopt_gen**relOpts=NULL;
193-
staticbits32last_assigned_kind=RELOPT_KIND_LAST_DEFAULT <<1;
193+
staticbits32last_assigned_kind=RELOPT_KIND_LAST_DEFAULT;
194194

195195
staticintnum_custom_options=0;
196196
staticrelopt_gen**custom_options=NULL;
@@ -278,17 +278,13 @@ initialize_reloptions(void)
278278
relopt_kind
279279
add_reloption_kind(void)
280280
{
281-
relopt_kindkind;
282-
283-
/* don't hand out the last bit so that the wraparound check is portable */
281+
/* don't hand out the last bit so that the enum's behavior is portable */
284282
if (last_assigned_kind >=RELOPT_KIND_MAX)
285283
ereport(ERROR,
286284
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
287285
errmsg("user-defined relation parameter types limit exceeded")));
288-
289-
kind= (relopt_kind)last_assigned_kind;
290286
last_assigned_kind <<=1;
291-
returnkind;
287+
return(relopt_kind)last_assigned_kind;
292288
}
293289

294290
/*

‎src/include/access/reloptions.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
1212
* Portions Copyright (c) 1994, Regents of the University of California
1313
*
14-
* $PostgreSQL: pgsql/src/include/access/reloptions.h,v 1.14 2009/04/04 00:45:02 alvherre Exp $
14+
* $PostgreSQL: pgsql/src/include/access/reloptions.h,v 1.15 2009/05/24 22:22:44 tgl Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -41,7 +41,8 @@ typedef enum relopt_kind
4141
RELOPT_KIND_GIST= (1 <<5),
4242
/* if you add a new kind, make sure you update "last_default" too */
4343
RELOPT_KIND_LAST_DEFAULT=RELOPT_KIND_GIST,
44-
RELOPT_KIND_MAX= (1 <<31)
44+
/* some compilers treat enums as signed ints, so we can't use 1 << 31 */
45+
RELOPT_KIND_MAX= (1 <<30)
4546
}relopt_kind;
4647

4748
/* reloption namespaces allowed for heaps -- currently only TOAST */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp