projects
/
idzebra-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Read-only sets uses common no write handler
[idzebra-moved-to-github.git]
/
isamc
/
merge.c
diff --git
a/isamc/merge.c
b/isamc/merge.c
index
b237dcf
..
7efc89b
100644
(file)
--- a/
isamc/merge.c
+++ b/
isamc/merge.c
@@
-1,8
+1,5
@@
-/* $Id: merge.c,v 1.33 2007-01-15 15:10:18 adam Exp $
- Copyright (C) 1995-2007
- Index Data ApS
-
-This file is part of the Zebra server.
+/* This file is part of the Zebra server.
+ 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
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
@@
-20,6
+17,9
@@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
@@
-72,7
+72,7
@@
static void flush_blocks (ISAMC is, struct isamc_merge_block *mb, int ptr,
for (i = 0; i<ptr; i++)
{
/* consider this block number */
for (i = 0; i<ptr; i++)
{
/* consider this block number */
- if (!mb[i].block)
+ if (!mb[i].block)
{
mb[i].block = isamc_alloc_block (is, cat);
mb[i].dirty = 1;
{
mb[i].block = isamc_alloc_block (is, cat);
mb[i].dirty = 1;
@@
-81,7
+81,7
@@
static void flush_blocks (ISAMC is, struct isamc_merge_block *mb, int ptr,
/* consider next block pointer */
if (last && i == ptr-1)
mb[i+1].block = 0;
/* consider next block pointer */
if (last && i == ptr-1)
mb[i+1].block = 0;
- else if (!mb[i+1].block)
+ else if (!mb[i+1].block)
{
mb[i+1].block = isamc_alloc_block (is, cat);
mb[i+1].dirty = 1;
{
mb[i+1].block = isamc_alloc_block (is, cat);
mb[i+1].dirty = 1;
@@
-141,11
+141,11
@@
static int get_border (ISAMC is, struct isamc_merge_block *mb, zint ptr,
/* Border set to initial fill or block size depending on
whether we are creating a new one or updating and old one.
*/
/* Border set to initial fill or block size depending on
whether we are creating a new one or updating and old one.
*/
-
+
int fill = mb[ptr].block ? is->method->filecat[cat].bsize :
is->method->filecat[cat].ifill;
int off = (ptr||firstpos) ? ISAMC_BLOCK_OFFSET_N : ISAMC_BLOCK_OFFSET_1;
int fill = mb[ptr].block ? is->method->filecat[cat].bsize :
is->method->filecat[cat].ifill;
int off = (ptr||firstpos) ? ISAMC_BLOCK_OFFSET_N : ISAMC_BLOCK_OFFSET_1;
-
+
assert (ptr < 199);
return mb[ptr].offset + fill - off;
assert (ptr < 199);
return mb[ptr].offset + fill - off;
@@
-157,12
+157,12
@@
void isamc_merge (ISAMC is, ISAM_P *ipos, ISAMC_I *data)
char i_item[128], *i_item_ptr;
int i_more, i_mode, i;
char i_item[128], *i_item_ptr;
int i_more, i_mode, i;
- ISAMC_PP pp;
+ ISAMC_PP pp;
char f_item[128], *f_item_ptr;
int f_more;
int last_dirty = 0;
int debug = is->method->debug;
char f_item[128], *f_item_ptr;
int f_more;
int last_dirty = 0;
int debug = is->method->debug;
-
+
struct isamc_merge_block mb[200];
zint firstpos = 0;
struct isamc_merge_block mb[200];
zint firstpos = 0;
@@
-207,10
+207,10
@@
void isamc_merge (ISAMC is, ISAM_P *ipos, ISAMC_I *data)
{
/* block to block boundary in the original file. */
f_more = 1;
{
/* block to block boundary in the original file. */
f_more = 1;
- if (cat == pp->cat)
+ if (cat == pp->cat)
{
/* the resulting output is of the same category as the
{
/* the resulting output is of the same category as the
- the original
+ the original
*/
if (r_offset <= mb[ptr].offset +is->method->filecat[cat].mfill)
{
*/
if (r_offset <= mb[ptr].offset +is->method->filecat[cat].mfill)
{
@@
-338,7
+338,7
@@
void isamc_merge (ISAMC is, ISAM_P *ipos, ISAMC_I *data)
int new_offset;
(*is->method->codec.encode)(r_clientData, &r_out_ptr, &src);
int new_offset;
(*is->method->codec.encode)(r_clientData, &r_out_ptr, &src);
- new_offset = r_out_ptr - r_buf;
+ new_offset = r_out_ptr - r_buf;
numKeys++;
numKeys++;
@@
-383,7
+383,7
@@
void isamc_merge (ISAMC is, ISAM_P *ipos, ISAMC_I *data)
if (cat < is->max_cat && ptr >= is->method->filecat[cat].mblocks)
{
/* Max number blocks in current category reached ->
if (cat < is->max_cat && ptr >= is->method->filecat[cat].mblocks)
{
/* Max number blocks in current category reached ->
- must switch to next category (with larger block size)
+ must switch to next category (with larger block size)
*/
int j = 0;
*/
int j = 0;
@@
-428,8
+428,8
@@
void isamc_merge (ISAMC is, ISAM_P *ipos, ISAMC_I *data)
}
if (mb[ptr].offset < r_offset)
{ /* make the final boundary offset */
}
if (mb[ptr].offset < r_offset)
{ /* make the final boundary offset */
- mb[++ptr].dirty = 1;
- mb[ptr].block = 0;
+ mb[++ptr].dirty = 1;
+ mb[ptr].block = 0;
mb[ptr].offset = r_offset;
}
else
mb[ptr].offset = r_offset;
}
else
@@
-482,6
+482,7
@@
void isamc_merge (ISAMC is, ISAM_P *ipos, ISAMC_I *data)
/*
* Local variables:
* c-basic-offset: 4
/*
* Local variables:
* c-basic-offset: 4
+ * c-file-style: "Stroustrup"
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab