Examples using Bib-1 use attributes
[idzebra-moved-to-github.git] / index / sortidx.c
index 6b52ee9..6c79a06 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the Zebra server.
-   Copyright (C) 1994-2011 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
@@ -18,7 +18,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
 
 
-#include <assert.h> 
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <assert.h>
 #include <string.h>
 
 #include <yaz/log.h>
@@ -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++;
         }