8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 14:03:07 +01:00

Fix unneeded evaluation of last item by COALESCE function, noted by Dmitry

This commit is contained in:
arnobrinkman 2005-06-03 21:14:35 +00:00
parent b2036511dc
commit 8affc50d24

View File

@ -1343,8 +1343,8 @@ static void gen_cast( dsql_req* request, const dsql_nod* node)
blr for expression 1
blr_value_if
blr_missing
blr for expression n
blr_null
blr for expression n-1
expression n
blr for expression n-1
@param request
@ -1358,7 +1358,7 @@ static void gen_coalesce( dsql_req* request, const dsql_nod* node)
stuff(request, blr_cast);
gen_descriptor(request, &node->nod_desc, true);
dsql_nod* const* ptr = list->nod_arg;
for (const dsql_nod* const* const end = ptr + list->nod_count;
for (const dsql_nod* const* const end = ptr + (list->nod_count - 1);
ptr < end; ptr++)
{
// IF (expression IS NULL) THEN
@ -1371,7 +1371,6 @@ static void gen_coalesce( dsql_req* request, const dsql_nod* node)
const dsql_nod* const* const begin = list->nod_arg;
ptr = list->nod_arg + list->nod_count;
// if all expressions are NULL return NULL
stuff(request, blr_null);
for (ptr--; ptr >= begin; ptr--)
{
GEN_expr(request, *ptr);