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

Commite0013de

Browse files
committed
Make better use of existing enums in plpgsql
plpgsql.h defines a number of enums, but most of the code passes themaround as ints. Update structs and function prototypes to take enumtypes instead. This clarifies the struct definitions in plpgsql.h inparticular.Reviewed-by: Pavel Stehule <pavel.stehule@gmail.com>
1 parent967a7b0 commite0013de

File tree

4 files changed

+67
-67
lines changed

4 files changed

+67
-67
lines changed

‎src/pl/plpgsql/src/pl_comp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static PLpgSQL_function *do_compile(FunctionCallInfo fcinfo,
9393
PLpgSQL_func_hashkey*hashkey,
9494
boolforValidator);
9595
staticvoidplpgsql_compile_error_callback(void*arg);
96-
staticvoidadd_parameter_name(intitemtype,intitemno,constchar*name);
96+
staticvoidadd_parameter_name(PLpgSQL_nsitem_typeitemtype,intitemno,constchar*name);
9797
staticvoidadd_dummy_return(PLpgSQL_function*function);
9898
staticNode*plpgsql_pre_column_ref(ParseState*pstate,ColumnRef*cref);
9999
staticNode*plpgsql_post_column_ref(ParseState*pstate,ColumnRef*cref,Node*var);
@@ -410,7 +410,7 @@ do_compile(FunctionCallInfo fcinfo,
410410
charargmode=argmodes ?argmodes[i] :PROARGMODE_IN;
411411
PLpgSQL_type*argdtype;
412412
PLpgSQL_variable*argvariable;
413-
intargitemtype;
413+
PLpgSQL_nsitem_typeargitemtype;
414414

415415
/* Create $n name for variable */
416416
snprintf(buf,sizeof(buf),"$%d",i+1);
@@ -946,7 +946,7 @@ plpgsql_compile_error_callback(void *arg)
946946
* Add a name for a function parameter to the function's namespace
947947
*/
948948
staticvoid
949-
add_parameter_name(intitemtype,intitemno,constchar*name)
949+
add_parameter_name(PLpgSQL_nsitem_typeitemtype,intitemno,constchar*name)
950950
{
951951
/*
952952
* Before adding the name, check for duplicates. We need this even though

‎src/pl/plpgsql/src/pl_exec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1557,7 +1557,7 @@ exec_stmt(PLpgSQL_execstate *estate, PLpgSQL_stmt *stmt)
15571557

15581558
CHECK_FOR_INTERRUPTS();
15591559

1560-
switch ((enumPLpgSQL_stmt_types)stmt->cmd_type)
1560+
switch (stmt->cmd_type)
15611561
{
15621562
casePLPGSQL_STMT_BLOCK:
15631563
rc=exec_stmt_block(estate, (PLpgSQL_stmt_block*)stmt);

‎src/pl/plpgsql/src/pl_funcs.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ plpgsql_ns_init(void)
5151
* ----------
5252
*/
5353
void
54-
plpgsql_ns_push(constchar*label,enumPLpgSQL_label_typeslabel_type)
54+
plpgsql_ns_push(constchar*label,PLpgSQL_label_typelabel_type)
5555
{
5656
if (label==NULL)
5757
label="";
@@ -89,7 +89,7 @@ plpgsql_ns_top(void)
8989
* ----------
9090
*/
9191
void
92-
plpgsql_ns_additem(intitemtype,intitemno,constchar*name)
92+
plpgsql_ns_additem(PLpgSQL_nsitem_typeitemtype,intitemno,constchar*name)
9393
{
9494
PLpgSQL_nsitem*nse;
9595

@@ -231,7 +231,7 @@ plpgsql_ns_find_nearest_loop(PLpgSQL_nsitem *ns_cur)
231231
constchar*
232232
plpgsql_stmt_typename(PLpgSQL_stmt*stmt)
233233
{
234-
switch ((enumPLpgSQL_stmt_types)stmt->cmd_type)
234+
switch (stmt->cmd_type)
235235
{
236236
casePLPGSQL_STMT_BLOCK:
237237
return_("statement block");
@@ -291,7 +291,7 @@ plpgsql_stmt_typename(PLpgSQL_stmt *stmt)
291291
* GET DIAGNOSTICS item name as a string, for use in error messages etc.
292292
*/
293293
constchar*
294-
plpgsql_getdiag_kindname(intkind)
294+
plpgsql_getdiag_kindname(PLpgSQL_getdiag_kindkind)
295295
{
296296
switch (kind)
297297
{
@@ -367,7 +367,7 @@ static void free_expr(PLpgSQL_expr *expr);
367367
staticvoid
368368
free_stmt(PLpgSQL_stmt*stmt)
369369
{
370-
switch ((enumPLpgSQL_stmt_types)stmt->cmd_type)
370+
switch (stmt->cmd_type)
371371
{
372372
casePLPGSQL_STMT_BLOCK:
373373
free_block((PLpgSQL_stmt_block*)stmt);
@@ -791,7 +791,7 @@ static void
791791
dump_stmt(PLpgSQL_stmt*stmt)
792792
{
793793
printf("%3d:",stmt->lineno);
794-
switch ((enumPLpgSQL_stmt_types)stmt->cmd_type)
794+
switch (stmt->cmd_type)
795795
{
796796
casePLPGSQL_STMT_BLOCK:
797797
dump_block((PLpgSQL_stmt_block*)stmt);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp