16d15 < 32c31 < if( tbl##btidx == BTREESEARCH ) /* delete index entry */ \ --- > if( tbl##btidx == BTREESEARCH ) \ 57c56 < /* parent table. It is identical to unlink_parent_nobp except that it is */ --- > /* parent table. It is identical to unlink_parent_nobp except that its is */ 68c67 < /* pointers are not unlinked. (Revised by RJL 020528 - initialized ca##curr2) */ --- > /* pointers are not unlinked. */ 70,78d68 < /* ~lechner/bde2alpha_rl/sandbox/bde/unlink_parent_nobp_m_genv13 */ < /* This macro fixed to properly initialize ca##curr2 - RJL 020528 */ < /* sample call: unlink_parent_nobp_m(HL, HN, HNid2, HLid2) */ < /* The first child pointer (pa##curr->c##__fcp) in the parent */ < /* becomes NULL when an only child is deleted. */ < /* This invariant is always true in the last child (if it exists): */ < /* assert (p##_fpp == p##_pp); */ < /* ca##curr should NOT be altered - it is used by del_row after return */ < /********************************************************************************/ 85c75 < ( (struct pa *) ca##curr->p##_fpp == pa##temp)) /* only child case */ \ --- > ( (struct pa *) ca##curr->p##_fpp == pa##temp)) /* only child case */ \ 90c80 < if ( pa##temp->c##_fcp == ca##temp ) /* first child case */ \ --- > if ( pa##temp->c##_fcp == ca##temp ) /* first child case */ \ 92,93c82,83 < pa##temp->c##_fcp = (struct ca *)ca##curr->p##_fpp; \ < ca##curr2 = (struct ca *)ca##curr->p##_fpp; /*not used!*/ \ --- > pa##temp->c##_fcp = (struct ca *)ca##curr->p##_fpp; \ > ca##curr2 = (struct ca *)ca##curr->p##_fpp; \ 95,101c85,91 < else /* middle or last child cases*/ \ < { /* find and update ca##curr2 to pred of ca##temp */ \ < ca##curr2 = pa##temp->c##_fcp; /* first child */ \ < while ((struct ca*) ca##curr2->p##_fpp != ca##temp) \ < ca##curr2 = (struct ca *) ca##curr2->p##_fpp; \ < assert ((struct ca*)ca##curr2->p##_fpp == ca##temp); \ < ca##curr2->p##_fpp = ca##temp->p##_fpp; \ --- > else /* middle or last child case */ \ > { \ > ca##curr2 = pa##temp->c##_fcp;\ > while((struct ca*) ca##curr2->p##_fpp != ca##temp) \ > ca##curr2 = (struct ca *) ca##curr2->p##_fpp; \ > assert((struct ca*) ca##curr2->p##_fpp == ca##temp); \ > ca##curr2->p##_fpp = ca##temp->p##_fpp; \ 107c97 < /* child table. It is identical to unlink_child_nobp except that it is for a */ --- > /* child table. It is identical to link_child_nobp except that it is for a */ 113,114c103 < /* WARNING: REQUIRES NULL _fcp to empty childset-RJL 020620 */\ < ca##temp->p##_pp = NULL --- > ca##temp->p##_pp = NULL 118,119c107,108 < /* child table. It is identical to unlink_child_bp except that back pointers */ < /* are not unlinked. */ --- > /* child table. It is identical to link_child_bp except that back pointers */ > /* are not unlinked. */ 121,124d109 < /* RJL 020612: THis NULLs the _pp and _fpp ptrs in EVERY child of pa##curr. */ < /* If unlinked from all its parent types, the child becomes unreachable */ < /* except by table_loop. pr_del removes this access and frees the object. */ < 129c114 < { /* unlink each child */\ --- > { \ 140,147d124 < /* Added by RJL 020612 : unlink_child_... is NOT SAFE if it 'deletes' children*/ < /* that can still be found by table-looping. The latter may find old child */ < /* rows that still have parent and forward/backward pointers (_pp, _fpp. etc.) */ < /* THis ought to be researched further, since unlinking all but their last parent*/ < /* might still be justified for children who have at least one other parent type.*/ < /* The most conservative way is to reject deletion of any parent untill after */ < /* all of its children are first deleted. */ < 222,226d198 < #ifdef DEBUG < printf("Unlinking HAcurr->HAid:%xl->%x\n", HAcurr, HAcurr->HAid); < printf("from parent HNcurr->HNid: %xl->%x\n", HNcurr, HNcurr->HNid); < < #endif 230c202 < printf("The primary key TO BE deleted is %s\n",temp_key); --- > printf("The primary key deleted is %s\n",temp_key); 233,238c205 < #ifdef DEBUG < pr_find(HA, HAid, temp_key); /* verify deletion completed */ < printf("After del_row(HA) on temp_pkey %s\n", temp_pkey); < printf("With parent HNcurr->HNid = %x->%s\n", HNcurr, HNcurr->HNid); < printf("pr_find(,,temp_pkey) sets HAcurr to %x\n", HAcurr); < #endif --- > 267,268c234,235 < decode(temp_key, &HPcurr->HPid); < printf("The primary key deleted is %s\n",temp_key); --- > decode(temp_key, &HPcurr->HPid); > printf("The primary key deleted is %s\n",temp_key); 270c237 < del_row(HP); --- > del_row(HP); 272c239 < /* The following is to support logging */ --- > /* The following is to support logging */ 275a243 > 326d293 < 333d299 < 342,344c308,310 < default: printf("\n\tWARNING: pr_del_bt(%s, %x) called: not implemented \n\n", < temp1, (unsigned int) *temp2); < } --- > default: printf("\n\tWARNING: pr_del_bt(%s, %x) called: not implemented \n\n", > temp1, (unsigned int) *temp2); > }