MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / post_map

Function post_map

src/gpre/sqe.cpp:3566–3600  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3564//
3565
3566static gpre_nod* post_map( gpre_nod* node, map* to_map)
3567{
3568 mel* element;
3569
3570 assert_IS_NOD(node);
3571
3572 // Search existing map for equivalent expression. If we find one,
3573 // return a reference to it.
3574
3575 if (node->nod_type == nod_map_ref)
3576 {
3577 element = (mel*) node->nod_arg[0];
3578 if (element->mel_context == to_map->map_context)
3579 return node;
3580 }
3581
3582 for (element = to_map->map_elements; element; element = element->mel_next)
3583 {
3584 if (compare_expr(node, element->mel_expr))
3585 return MSC_unary(nod_map_ref, (gpre_nod*) element);
3586 }
3587
3588 // We need to make up a new map reference
3589
3590 element = (mel*) MSC_alloc(sizeof(mel));
3591 element->mel_next = to_map->map_elements;
3592 to_map->map_elements = element;
3593 element->mel_position = to_map->map_count++;
3594 element->mel_expr = node;
3595 element->mel_context = to_map->map_context;
3596
3597 // Make up a reference to the map element
3598
3599 return MSC_unary(nod_map_ref, (gpre_nod*) element);
3600}
3601
3602
3603//____________________________________________________________

Callers 5

SQE_fieldFunction · 0.85
par_orderFunction · 0.85
par_primitive_valueFunction · 0.85
post_fieldsFunction · 0.85
post_select_listFunction · 0.85

Calls 3

compare_exprFunction · 0.85
MSC_unaryFunction · 0.85
MSC_allocFunction · 0.85

Tested by

no test coverage detected