X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=blobdiff_plain;f=dict%2Finsert.c;h=506fe1726b656fd5100f0c7e4ad5510600863226;hp=0652f00a24ce7b746ba08aaac4af39f91cf69289;hb=8a0144a3925311102133d62ac6258ace8d7187eb;hpb=a89d8384ad975fdddb2aa56e8c27b689a5e23f96 diff --git a/dict/insert.c b/dict/insert.c index 0652f00..506fe17 100644 --- a/dict/insert.c +++ b/dict/insert.c @@ -1,5 +1,5 @@ /* This file is part of the Zebra server. - Copyright (C) 1994-2009 Index Data + Copyright (C) Index Data 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 @@ -19,6 +19,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#if HAVE_CONFIG_H +#include +#endif #include #include #include @@ -96,7 +99,7 @@ static int split_page(Dict dict, Dict_ptr ptr, void *p) best_indxp = indxp; } } - else + else { /* new char prefix. restore */ prev_char = dc; no_current = 1; @@ -142,7 +145,7 @@ static int split_page(Dict dict, Dict_ptr ptr, void *p) } static void clean_page(Dict dict, Dict_ptr ptr, void *p, Dict_char *out, - Dict_ptr subptr, char *userinfo) + Dict_ptr subptr, char *userinfo) { char *np = (char *) xmalloc(dict->head.page_size); int i, slen, no = 0; @@ -177,8 +180,8 @@ static void clean_page(Dict dict, Dict_ptr ptr, void *p, Dict_char *out, info2 += *userinfo + 1; } else - *info2++ = 0; - subptr = 0; + *info2++ = 0; + subptr = 0; ++no; continue; } @@ -208,7 +211,7 @@ static void clean_page(Dict dict, Dict_ptr ptr, void *p, Dict_char *out, ++no; } #if 1 - memcpy((char*)p+DICT_infoffset, + memcpy((char*)p+DICT_infoffset, (char*)np+DICT_infoffset, info2 - ((char*)np+DICT_infoffset)); memcpy((char*)p + ((char*)indxp2 - (char*)np), @@ -240,7 +243,7 @@ static int dict_ins(Dict dict, const Dict_char *str, void *p; dict_bf_readp(dict->dbf, ptr, &p); - + assert(p); assert(ptr); @@ -338,7 +341,7 @@ static int dict_ins(Dict dict, const Dict_char *str, return dict_ins(dict, str-1, ptr, userlen, userinfo); } - if (split_page(dict, ptr, p)) + if (split_page(dict, ptr, p)) { yaz_log(YLOG_FATAL, "Unable to split page %d\n", ptr); assert(0);