fix abolish_table/1 ans abolish_all_tables/0 built-in predicates

This commit is contained in:
Joao 2011-04-29 17:29:02 +01:00
parent affaeb4092
commit 719b04fee3

View File

@ -337,10 +337,8 @@ static Int p_abolish_table( USES_REGS1 ) {
TabEnt_hash_chain(tab_ent) = NULL; TabEnt_hash_chain(tab_ent) = NULL;
free_subgoal_hash_chain(hash); free_subgoal_hash_chain(hash);
sg_node = TrNode_child(TabEnt_subgoal_trie(tab_ent)); sg_node = TrNode_child(TabEnt_subgoal_trie(tab_ent));
TrNode_child(TabEnt_subgoal_trie(tab_ent)) = NULL;
if (sg_node) { if (sg_node) {
if (TabEnt_arity(tab_ent)) { if (TabEnt_arity(tab_ent)) {
TrNode_child(TabEnt_subgoal_trie(tab_ent)) = NULL;
free_subgoal_trie(sg_node, TRAVERSE_MODE_NORMAL, TRAVERSE_POSITION_FIRST); free_subgoal_trie(sg_node, TRAVERSE_MODE_NORMAL, TRAVERSE_POSITION_FIRST);
} else { } else {
sg_fr_ptr sg_fr = UNTAG_SUBGOAL_LEAF_NODE(sg_node); sg_fr_ptr sg_fr = UNTAG_SUBGOAL_LEAF_NODE(sg_node);
@ -350,6 +348,7 @@ static Int p_abolish_table( USES_REGS1 ) {
#endif /* LIMIT_TABLING */ #endif /* LIMIT_TABLING */
FREE_SUBGOAL_FRAME(sg_fr); FREE_SUBGOAL_FRAME(sg_fr);
} }
TrNode_child(TabEnt_subgoal_trie(tab_ent)) = NULL;
} }
return (TRUE); return (TRUE);
} }
@ -366,10 +365,8 @@ static Int p_abolish_all_tables( USES_REGS1 ) {
TabEnt_hash_chain(tab_ent) = NULL; TabEnt_hash_chain(tab_ent) = NULL;
free_subgoal_hash_chain(hash); free_subgoal_hash_chain(hash);
sg_node = TrNode_child(TabEnt_subgoal_trie(tab_ent)); sg_node = TrNode_child(TabEnt_subgoal_trie(tab_ent));
TrNode_child(TabEnt_subgoal_trie(tab_ent)) = NULL; if (sg_node) {
if (sg_node) {
if (TabEnt_arity(tab_ent)) { if (TabEnt_arity(tab_ent)) {
TrNode_child(TabEnt_subgoal_trie(tab_ent)) = NULL;
free_subgoal_trie(sg_node, TRAVERSE_MODE_NORMAL, TRAVERSE_POSITION_FIRST); free_subgoal_trie(sg_node, TRAVERSE_MODE_NORMAL, TRAVERSE_POSITION_FIRST);
} else { } else {
sg_fr_ptr sg_fr = UNTAG_SUBGOAL_LEAF_NODE(sg_node); sg_fr_ptr sg_fr = UNTAG_SUBGOAL_LEAF_NODE(sg_node);
@ -379,6 +376,7 @@ static Int p_abolish_all_tables( USES_REGS1 ) {
#endif /* LIMIT_TABLING */ #endif /* LIMIT_TABLING */
FREE_SUBGOAL_FRAME(sg_fr); FREE_SUBGOAL_FRAME(sg_fr);
} }
TrNode_child(TabEnt_subgoal_trie(tab_ent)) = NULL;
} }
tab_ent = TabEnt_next(tab_ent); tab_ent = TabEnt_next(tab_ent);
} }