1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-29 23:43:17 +03:00

Rename value node fields

For the formerly-Value node types, rename the "val" field to a name
specific to the node type, namely "ival", "fval", "sval", and "bsval".
This makes some code clearer and catches mixups better.

Reviewed-by: Pavel Stehule <pavel.stehule@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/8c1a2e37-c68d-703c-5a83-7a6077f4f997@enterprisedb.com
This commit is contained in:
Peter Eisentraut
2022-01-14 10:46:49 +01:00
parent 93415a3b5a
commit c4cc2850f4
12 changed files with 53 additions and 53 deletions

View File

@@ -2745,16 +2745,16 @@ _copyA_Const(const A_Const *from)
switch (nodeTag(&from->val))
{
case T_Integer:
COPY_SCALAR_FIELD(val.ival.val);
COPY_SCALAR_FIELD(val.ival.ival);
break;
case T_Float:
COPY_STRING_FIELD(val.fval.val);
COPY_STRING_FIELD(val.fval.fval);
break;
case T_String:
COPY_STRING_FIELD(val.sval.val);
COPY_STRING_FIELD(val.sval.sval);
break;
case T_BitString:
COPY_STRING_FIELD(val.bsval.val);
COPY_STRING_FIELD(val.bsval.bsval);
break;
default:
elog(ERROR, "unrecognized node type: %d",
@@ -4934,7 +4934,7 @@ _copyInteger(const Integer *from)
{
Integer *newnode = makeNode(Integer);
COPY_SCALAR_FIELD(val);
COPY_SCALAR_FIELD(ival);
return newnode;
}
@@ -4944,7 +4944,7 @@ _copyFloat(const Float *from)
{
Float *newnode = makeNode(Float);
COPY_STRING_FIELD(val);
COPY_STRING_FIELD(fval);
return newnode;
}
@@ -4954,7 +4954,7 @@ _copyString(const String *from)
{
String *newnode = makeNode(String);
COPY_STRING_FIELD(val);
COPY_STRING_FIELD(sval);
return newnode;
}
@@ -4964,7 +4964,7 @@ _copyBitString(const BitString *from)
{
BitString *newnode = makeNode(BitString);
COPY_STRING_FIELD(val);
COPY_STRING_FIELD(bsval);
return newnode;
}

View File

@@ -3125,7 +3125,7 @@ _equalList(const List *a, const List *b)
static bool
_equalInteger(const Integer *a, const Integer *b)
{
COMPARE_SCALAR_FIELD(val);
COMPARE_SCALAR_FIELD(ival);
return true;
}
@@ -3133,7 +3133,7 @@ _equalInteger(const Integer *a, const Integer *b)
static bool
_equalFloat(const Float *a, const Float *b)
{
COMPARE_STRING_FIELD(val);
COMPARE_STRING_FIELD(fval);
return true;
}
@@ -3141,7 +3141,7 @@ _equalFloat(const Float *a, const Float *b)
static bool
_equalString(const String *a, const String *b)
{
COMPARE_STRING_FIELD(val);
COMPARE_STRING_FIELD(sval);
return true;
}
@@ -3149,7 +3149,7 @@ _equalString(const String *a, const String *b)
static bool
_equalBitString(const BitString *a, const BitString *b)
{
COMPARE_STRING_FIELD(val);
COMPARE_STRING_FIELD(bsval);
return true;
}

View File

@@ -3421,7 +3421,7 @@ _outA_Expr(StringInfo str, const A_Expr *node)
static void
_outInteger(StringInfo str, const Integer *node)
{
appendStringInfo(str, "%d", node->val);
appendStringInfo(str, "%d", node->ival);
}
static void
@@ -3431,7 +3431,7 @@ _outFloat(StringInfo str, const Float *node)
* We assume the value is a valid numeric literal and so does not
* need quoting.
*/
appendStringInfoString(str, node->val);
appendStringInfoString(str, node->fval);
}
static void
@@ -3442,8 +3442,8 @@ _outString(StringInfo str, const String *node)
* but we don't want it to do anything with an empty string.
*/
appendStringInfoChar(str, '"');
if (node->val[0] != '\0')
outToken(str, node->val);
if (node->sval[0] != '\0')
outToken(str, node->sval);
appendStringInfoChar(str, '"');
}
@@ -3451,7 +3451,7 @@ static void
_outBitString(StringInfo str, const BitString *node)
{
/* internal representation already has leading 'b' */
appendStringInfoString(str, node->val);
appendStringInfoString(str, node->bsval);
}
static void

View File

@@ -24,7 +24,7 @@ makeInteger(int i)
{
Integer *v = makeNode(Integer);
v->val = i;
v->ival = i;
return v;
}
@@ -38,7 +38,7 @@ makeFloat(char *numericStr)
{
Float *v = makeNode(Float);
v->val = numericStr;
v->fval = numericStr;
return v;
}
@@ -52,7 +52,7 @@ makeString(char *str)
{
String *v = makeNode(String);
v->val = str;
v->sval = str;
return v;
}
@@ -66,6 +66,6 @@ makeBitString(char *str)
{
BitString *v = makeNode(BitString);
v->val = str;
v->bsval = str;
return v;
}