X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=blobdiff_plain;f=index%2Fsortidx.c;h=475af8f6a60aeecc2f4c9de3ad1a953df67043d6;hp=82f7e7fc04945550529f7290029f05e86365aca4;hb=27bdd6aa26843aeac89f635ed495996088d8e8aa;hpb=6277df6076edfef81e676d4aab7bd1f212bf739f diff --git a/index/sortidx.c b/index/sortidx.c index 82f7e7f..475af8f 100644 --- a/index/sortidx.c +++ b/index/sortidx.c @@ -1,5 +1,5 @@ /* This file is part of the Zebra server. - Copyright (C) 1995-2008 Index Data + Copyright (C) 2004-2013 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 @@ -18,7 +18,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include +#if HAVE_CONFIG_H +#include +#endif +#include #include #include @@ -155,7 +158,7 @@ static int sort_term_code_read(void *vp, char **dst, int *insertMode) return 0; (s->no)--; - + *insertMode = s->insert_flag; memcpy(*dst, &s->st, sizeof(s->st)); *dst += sizeof(s->st); @@ -279,7 +282,7 @@ int zebra_sort_type(zebra_sort_index_t si, int id) case ZEBRA_SORT_TYPE_ISAMB: method.codec.encode = sort_term_encode1; method.codec.decode = sort_term_decode1; - + sprintf(fname, "sortb%d", id); sf->u.isamb = isamb_open2(si->bfs, fname, si->write_flag, &method, /* cache */ 0, @@ -299,7 +302,7 @@ int zebra_sort_type(zebra_sort_index_t si, int id) isam_block_size = 32768; method.codec.encode = sort_term_encode2; method.codec.decode = sort_term_decode2; - + sprintf(fname, "sortm%d", id); sf->u.isamb = isamb_open2(si->bfs, fname, si->write_flag, &method, /* cache */ 0, @@ -373,12 +376,12 @@ void zebra_sort_delete(zebra_sort_index_t si, zint section_id) s.st.section_id = section_id; s.st.length = 0; s.st.term[0] = '\0'; - + s.no = 1; s.insert_flag = 0; isamc_i.clientData = &s; isamc_i.read_item = sort_term_code_read; - + isamb_merge(sf->u.isamb, &sf->isam_p, &isamc_i); sf->no_deleted++; } @@ -400,7 +403,7 @@ void zebra_sort_add(zebra_sort_index_t si, zint section_id, WRBUF wrbuf) len = strlen(wrbuf_buf(wrbuf)); if (len > SORT_IDX_ENTRYSIZE) len = SORT_IDX_ENTRYSIZE; - + memcpy(si->entry_buf, wrbuf_buf(wrbuf), len); if (len < SORT_IDX_ENTRYSIZE-len) memset(si->entry_buf+len, 0, SORT_IDX_ENTRYSIZE-len); @@ -429,7 +432,7 @@ void zebra_sort_add(zebra_sort_index_t si, zint section_id, WRBUF wrbuf) s.insert_flag = 1; isamc_i.clientData = &s; isamc_i.read_item = sort_term_code_read; - + isamb_merge(sf->u.isamb, &sf->isam_p, &isamc_i); sf->no_inserted++; } @@ -454,7 +457,7 @@ void zebra_sort_add(zebra_sort_index_t si, zint section_id, WRBUF wrbuf) s.insert_flag = 1; isamc_i.clientData = &s; isamc_i.read_item = sort_term_code_read; - + isamb_merge(sf->u.isamb, &sf->isam_p, &isamc_i); sf->no_inserted++; } @@ -515,6 +518,7 @@ int zebra_sort_read(zebra_sort_index_t si, zint *section_id, WRBUF w) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab