Skip to content

Commit 352f329

Browse files
LiuZizhuanhackorum
authored andcommitted
Little refactoring of makefuncs.c
1 parent 19733fa commit 352f329

1 file changed

Lines changed: 7 additions & 30 deletions

File tree

src/backend/nodes/makefuncs.c

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,8 @@ A_Expr *
4848
makeSimpleA_Expr(A_Expr_Kind kind, char *name,
4949
Node *lexpr, Node *rexpr, int location)
5050
{
51-
A_Expr *a = makeNode(A_Expr);
52-
53-
a->kind = kind;
54-
a->name = list_make1(makeString(name));
55-
a->lexpr = lexpr;
56-
a->rexpr = rexpr;
57-
a->location = location;
58-
return a;
51+
return makeA_Expr(kind, list_make1(makeString(name)),
52+
lexpr, rexpr, location);
5953
}
6054

6155
/*
@@ -655,13 +649,11 @@ DefElem *
655649
makeDefElemExtended(char *nameSpace, char *name, Node *arg,
656650
DefElemAction defaction, int location)
657651
{
658-
DefElem *res = makeNode(DefElem);
652+
653+
DefElem *res = makeDefElem(name, arg, location);
659654

660655
res->defnamespace = nameSpace;
661-
res->defname = name;
662-
res->arg = arg;
663656
res->defaction = defaction;
664-
res->location = location;
665657

666658
return res;
667659
}
@@ -726,12 +718,7 @@ make_opclause(Oid opno, Oid opresulttype, bool opretset,
726718
Expr *
727719
make_andclause(List *andclauses)
728720
{
729-
BoolExpr *expr = makeNode(BoolExpr);
730-
731-
expr->boolop = AND_EXPR;
732-
expr->args = andclauses;
733-
expr->location = -1;
734-
return (Expr *) expr;
721+
return makeBoolExpr(AND_EXPR, andclauses, -1);
735722
}
736723

737724
/*
@@ -742,12 +729,7 @@ make_andclause(List *andclauses)
742729
Expr *
743730
make_orclause(List *orclauses)
744731
{
745-
BoolExpr *expr = makeNode(BoolExpr);
746-
747-
expr->boolop = OR_EXPR;
748-
expr->args = orclauses;
749-
expr->location = -1;
750-
return (Expr *) expr;
732+
return makeBoolExpr(OR_EXPR, orclauses, -1);
751733
}
752734

753735
/*
@@ -758,12 +740,7 @@ make_orclause(List *orclauses)
758740
Expr *
759741
make_notclause(Expr *notclause)
760742
{
761-
BoolExpr *expr = makeNode(BoolExpr);
762-
763-
expr->boolop = NOT_EXPR;
764-
expr->args = list_make1(notclause);
765-
expr->location = -1;
766-
return (Expr *) expr;
743+
return makeBoolExpr(NOT_EXPR, list_make1(notclause), -1);
767744
}
768745

769746
/*

0 commit comments

Comments
 (0)