Commit f71863a4 authored by Per Cederqvist's avatar Per Cederqvist

Revision 1.9 was totally broken. The commit failed, somehow. This

revision contains what *should* have been revision 1.9.
parent 7ea643af
......@@ -791,55 +791,60 @@ l2g_delete_global_in_sorted(Local_to_global *l2g,
for (l2gi_searchall(&iter, l2g); !iter.search_ended; l2gi_next(&iter))
if (iter.tno == tno)
{
L;
binfo->value_block = smalloc(L2G_BLOCKSIZE * sizeof(Text_no));
#ifndef NDEBUG
for (i = 0; i < L2G_BLOCKSIZE; ++i)
binfo->value_block[i] = 0xdeadbeef;
#endif
return binfo;
l2g_delete(l2g, iter.lno);
return;
}
}
/*
* Delete a block from the Local_to_global L2G. The pointer BINFO
* points at the block, which is supposed to be empty.
* Dump the internal structure of L2G onto the file FILE.
*/
static void
delete_block(Local_to_global *l2g,
struct l2g_block_info *binfo)
void
l2g_dump(FILE *file,
const Local_to_global *l2g)
{
assert(is_empty(binfo));
struct l2g_block_info * binfo;
int i, j;
/* Remove the blocks from the Block Info */
if (binfo->key_block != NULL)
sfree(binfo->key_block);
sfree(binfo->value_block);
fprintf(file, "Number of blocks: %d\n", l2g->num_blocks);
fprintf(file, "First unused: %lu\n", l2g->first_unused);
/* Compact the remaining blocks. */
while (++binfo < l2g->blocks + l2g->num_blocks)
*(binfo - 1) = *binfo;
l2g->num_blocks--;
l2g->blocks = srealloc(l2g->blocks,
l2g->num_blocks * sizeof(struct l2g_block_info));
binfo = l2g->blocks;
for (i = 0; i < l2g->num_blocks; ++i) {
fprintf(file, "%d: %d %d %d (%s) [", i,
binfo->first_free,
binfo->zeroes,
(int) binfo->start,
(is_dense(binfo) ? "dense" : "sparse"));
if (is_dense(binfo)) {
for (j = 0; j < binfo->first_free; ++j) {
fprintf(file, "%d ", (int) binfo->value_block[j]);
}
} else {
for (j = 0; j < binfo->first_free; ++j) {
fprintf(file, "%d:%d ",
(int) binfo->key_block[j],
(int) binfo->value_block[j]);
}
}
fprintf(file, "]\n");
binfo++;
}
}
/*
* Make a sparse block from a dense one.
* Read a Local to global structure from the file FILE.
*/
static void
make_sparse(struct l2g_block_info *binfo)
{
int next;
int i;
assert(is_dense(binfo));
/* Allocate the room for the key bl int c;
Success
l2g_read(FILE *fp, Local_to_global *l2g)
{
int c;
Local_text_no lno;
Text_no tno;
Local_text_no first_unused;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment