WriteNodoHeader (npadre, &nhp);
WriteBlock (npadre, padre);
- /* TODO: Recuperar nodo1 y nodo2 */
+ deleted_nodes.push_back (node1);
+ deleted_nodes.push_back (node2);
} else {
WriteKeys (n1, nh1, newkeys);
WriteNodoHeader (n1, &nh1);
WriteBlock (n1, node1);
- /* TODO : Recuperar node2 */
+ deleted_nodes.push_back (node2);
+
/* Actualizo punero al padre */
(*anterior)->SetChild (node1);
uchar *node;
BTreeNodeHeader nh;
- fseek (fp, 0, SEEK_END);
- filelen = ftell (fp);
+ std::list<uint>::iterator it;
+ it = deleted_nodes.begin ();
- num = filelen/header.block_size - 1;
+ if (it != deleted_nodes.end ()) {
+ num = *it;
+ deleted_nodes.erase (it);
+ } else {
+ fseek (fp, 0, SEEK_END);
+ filelen = ftell (fp);
+ num = filelen/header.block_size - 1;
+ }
node = new uchar[header.block_size];
ReadNodoHeader (node, &nh);
nh.level = 0;