static int is_leftmost(const struct node *node) { if (node->parent != NULL && node->parent->left == node && node->parent->tok == '=') { return (1); } else if (node->parent != NULL && node->parent->left == node && node->parent->tok == '.') { return (is_leftmost(node->parent)); } else { return (0); } }
void elem::destroy() { if (! is_leftmost()) { // Call destroy_fn and deallocate_fn on the view, but not if it's the // leftmost view. cilk_c_monoid *monoid = &(hb->__c_monoid); cilk_c_reducer_destroy_fn_t destroy_fn = monoid->destroy_fn; cilk_c_reducer_deallocate_fn_t deallocate_fn = monoid->deallocate_fn; destroy_fn((void*)hb, view); deallocate_fn((void*)hb, view); } view = 0; }