X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=dict%2Fdcompact.c;h=bfe9845955a866b4edf8c10c6b022215a7604e40;hb=861a4414a4a0d1d1076f97fe8105b0a3a3ab4a31;hp=5ae44021f4fbb220252bc10d3141ed460233ea8e;hpb=1b1c0452f350e2a499535f40540f0d3a034a9738;p=idzebra-moved-to-github.git diff --git a/dict/dcompact.c b/dict/dcompact.c index 5ae4402..bfe9845 100644 --- a/dict/dcompact.c +++ b/dict/dcompact.c @@ -1,36 +1,33 @@ -/* - * Copyright (C) 1994-1999, Index Data - * All rights reserved. - * Sebastian Hammer, Adam Dickmeiss - * - * $Log: dcompact.c,v $ - * Revision 1.6 1999-09-07 08:13:08 adam - * Removed log messages. - * - * Revision 1.5 1999/05/26 07:49:12 adam - * C++ compilation. - * - * Revision 1.4 1999/05/15 14:36:37 adam - * Updated dictionary. Implemented "compression" of dictionary. - * - * Revision 1.3 1999/05/12 13:08:06 adam - * First version of ISAMS. - * - * Revision 1.2 1999/03/09 16:27:49 adam - * More work on SDRKit integration. - * - * Revision 1.1 1999/03/09 13:07:06 adam - * Work on dict_compact routine. - * - */ +/* $Id: dcompact.c,v 1.15 2006-08-14 10:40:09 adam Exp $ + Copyright (C) 1995-2006 + Index Data ApS + +This file is part of the Zebra server. + +Zebra is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +Zebra is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + + #include #include #include #include -#include -#include +#include "dict-p.h" static void dict_copy_page(Dict dict, char *to_p, char *from_p, int *map) { @@ -95,13 +92,13 @@ int dict_copy_compact (BFiles bfs, const char *from_name, const char *to_name) int no_dir = 0; Dict dict_from, dict_to; int *map, i; - dict_from = dict_open (bfs, from_name, 0, 0, 0); + dict_from = dict_open (bfs, from_name, 0, 0, 0, 4096); if (!dict_from) return -1; map = (int *) xmalloc ((dict_from->head.last+1) * sizeof(*map)); for (i = 0; i <= (int) (dict_from->head.last); i++) map[i] = -1; - dict_to = dict_open (bfs, to_name, 0, 1, 1); + dict_to = dict_open (bfs, to_name, 0, 1, 1, 4096); if (!dict_to) return -1; map[0] = 0; @@ -112,7 +109,7 @@ int dict_copy_compact (BFiles bfs, const char *from_name, const char *to_name) void *buf; int size; #if 0 - logf (LOG_LOG, "map[%d] = %d", i, map[i]); + yaz_log (YLOG_LOG, "map[%d] = %d", i, map[i]); #endif dict_bf_readp (dict_from->dbf, i, &buf); size = ((DICT_size(buf)+sizeof(short)-1)/sizeof(short) + @@ -121,8 +118,8 @@ int dict_copy_compact (BFiles bfs, const char *from_name, const char *to_name) no_dir += DICT_nodir(buf); } #if 0 - logf (LOG_LOG, "map[%d] = %d", i, map[i]); - logf (LOG_LOG, "nodir = %d", no_dir); + yaz_log (YLOG_LOG, "map[%d] = %d", i, map[i]); + yaz_log (YLOG_LOG, "nodir = %d", no_dir); #endif dict_to->head.root = map[1]; dict_to->head.last = map[i]; @@ -131,7 +128,7 @@ int dict_copy_compact (BFiles bfs, const char *from_name, const char *to_name) void *old_p, *new_p; dict_bf_readp (dict_from->dbf, i, &old_p); - logf (LOG_LOG, "dict_bf_newp no=%d size=%d", map[i], + yaz_log (YLOG_LOG, "dict_bf_newp no=%d size=%d", map[i], map[i+1] - map[i]); dict_bf_newp (dict_to->dbf, map[i], &new_p, map[i+1] - map[i]); @@ -145,3 +142,11 @@ int dict_copy_compact (BFiles bfs, const char *from_name, const char *to_name) dict_close (dict_to); return 0; } +/* + * Local variables: + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +