X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=isam%2Fmemory.c;fp=isam%2Fmemory.c;h=b5dcdfacb44e3b90a12fbe4b7865800885250d73;hb=288e50e499479a436edb71358c51fb8317c26da3;hp=d7a327cd0cc4b342f00562942442809c0e32c15a;hpb=144e8636e37a45caf6596b8e65e60ac69e315a31;p=idzebra-moved-to-github.git diff --git a/isam/memory.c b/isam/memory.c index d7a327c..b5dcdfa 100644 --- a/isam/memory.c +++ b/isam/memory.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: memory.c,v $ - * Revision 1.10 1995-12-12 14:12:47 quinn + * Revision 1.11 1996-02-10 12:20:58 quinn + * *** empty log message *** + * + * Revision 1.10 1995/12/12 14:12:47 quinn * *** empty log message *** * * Revision 1.9 1995/12/06 15:48:46 quinn @@ -233,18 +236,28 @@ void is_m_delete_record(is_mtable *tab) mbuf->num--; mbuf->cur_record--; } - else /* middle of a block */ + else if (mbuf->cur_record == 1) /* beginning of mbuf */ { + mbuf->num--; + mbuf->offset +=is_keysize(tab->is); + mbuf->cur_record = 0; + } + else /* middle of mbuf */ + { + /* insert block after current one */ new = xmalloc_mbuf(IS_MBUF_TYPE_SMALL); new->next = mbuf->next; mbuf->next = new; + + /* virtually transfer everything after current record to new one. */ new->data = mbuf->data; mbuf->refcount++; new->offset = mbuf->offset + mbuf->cur_record * is_keysize(tab->is); new->num = mbuf->num - mbuf->cur_record; + + /* old buf now only contains stuff before current record */ mbuf->num = mbuf->cur_record -1; - mbuf = mbuf->next; - mbuf->cur_record = 0; + tab->cur_mblock->cur_mbuf = new; } tab->num_records--; tab->cur_mblock->num_records--;