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

Commitd77f014

Browse files
committed
Improve implementation of EEOP_BOOLTEST_* opcodes.
Both Andres and I were happy with "*op->resvalue = *op->resvalue;",but Coverity isn't; and it has a point, because some compilers mightnot be smart enough to elide that. So remove it. In passing, alsoavoid doing unnecessary assignments to *op->resnull when it's alreadyknown to have the right value.
1 parente259e1f commitd77f014

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

‎src/backend/executor/execExprInterp.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -958,43 +958,49 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
958958
EEO_CASE(EEOP_BOOLTEST_IS_TRUE)
959959
{
960960
if (*op->resnull)
961+
{
961962
*op->resvalue=BoolGetDatum(false);
962-
else
963-
*op->resvalue=*op->resvalue;
964-
*op->resnull= false;
963+
*op->resnull= false;
964+
}
965+
/* else, input value is the correct output as well */
965966

966967
EEO_NEXT();
967968
}
968969

969970
EEO_CASE(EEOP_BOOLTEST_IS_NOT_TRUE)
970971
{
971972
if (*op->resnull)
973+
{
972974
*op->resvalue=BoolGetDatum(true);
975+
*op->resnull= false;
976+
}
973977
else
974978
*op->resvalue=BoolGetDatum(!DatumGetBool(*op->resvalue));
975-
*op->resnull= false;
976979

977980
EEO_NEXT();
978981
}
979982

980983
EEO_CASE(EEOP_BOOLTEST_IS_FALSE)
981984
{
982985
if (*op->resnull)
986+
{
983987
*op->resvalue=BoolGetDatum(false);
988+
*op->resnull= false;
989+
}
984990
else
985991
*op->resvalue=BoolGetDatum(!DatumGetBool(*op->resvalue));
986-
*op->resnull= false;
987992

988993
EEO_NEXT();
989994
}
990995

991996
EEO_CASE(EEOP_BOOLTEST_IS_NOT_FALSE)
992997
{
993998
if (*op->resnull)
999+
{
9941000
*op->resvalue=BoolGetDatum(true);
995-
else
996-
*op->resvalue=*op->resvalue;
997-
*op->resnull= false;
1001+
*op->resnull= false;
1002+
}
1003+
/* else, input value is the correct output as well */
9981004

9991005
EEO_NEXT();
10001006
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp