X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=isamb%2Fisamb.c;h=65bed28900fdb9141360519955d1c520960423f8;hb=d8e4054c431384d7642d33255c55ad0706e5f793;hp=706d0df18a3d476f4c80ee6213390dd5e95a2cc9;hpb=0b366aebe8bbba8de457b4b2d9571cbf2dd43352;p=idzebra-moved-to-github.git diff --git a/isamb/isamb.c b/isamb/isamb.c index 706d0df..65bed28 100644 --- a/isamb/isamb.c +++ b/isamb/isamb.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-1998, Index Data. * See the file LICENSE for details. * - * $Id: isamb.c,v 1.4 2002-04-17 08:17:13 adam Exp $ + * $Id: isamb.c,v 1.6 2002-04-17 09:03:38 adam Exp $ */ #include #include @@ -71,7 +71,7 @@ ISAMB isamb_open (BFiles bfs, const char *name, int writeflag, ISAMC_M method) isamb->bfs = bfs; isamb->method = (ISAMC_M) xmalloc (sizeof(*method)); memcpy (isamb->method, method, sizeof(*method)); - isamb->no_cat = 4; + isamb->no_cat = 2; isamb->file = xmalloc (sizeof(*isamb->file) * isamb->no_cat); for (i = 0; ino_cat; i++) @@ -436,7 +436,7 @@ int insert_flat (ISAMB b, const void *new_item, ISAMC_P *posp) p->dirty = 1; } new_size = dst - dst_buf + ISAMB_DATA_OFFSET; - if (p && new_size > p->size) + if (p && new_size > b->file[p->cat].head.block_size) { yaz_log (LOG_LOG, "resize %d -> %d", p->size, new_size); close_block (b, p); @@ -472,10 +472,11 @@ int isamb_insert_one (ISAMB b, const void *item, ISAMC_P pos) else { /* b-tree insert */ - struct ISAMB_block *p, *sp = 0; + struct ISAMB_block *p = open_block (b, pos), *sp = 0; char sub_item[DST_ITEM_MAX]; int sub_size; + insert_sub (b, p, item, &sp, sub_item, &sub_size); if (sp) { /* increase level of tree by one */