diff --git a/src/server/local-to-global.c b/src/server/local-to-global.c index 62a1980c269b77837acf66e95a4e00c1f889234f..5c43011a34548c2f72c3640768d19d1d986a6a32 100644 --- a/src/server/local-to-global.c +++ b/src/server/local-to-global.c @@ -10,6 +10,12 @@ #include <malloc.h> + +#include <sys/types.h> +#include <time.h> + +#include "s-string.h" + #include "kom-types.h" #include "local-to-global.h" @@ -370,16 +376,7 @@ l2g_next_key(Local_to_global *l2g, Local_text_no lno) return 0; /* If lno is lower than the first text, treat this as a special case. */ - if (lno < binfo->start) { - /* - * Kid of ugly. This pointer is decremented here to point one - * item before the first block, but it is incremented again - * below. This way we can use the code below without having - * to copy it here. - */ - --binfo; - - } else { + if (lno >= binfo->start) { /* Check the found block */ if (binfo->key_block == NULL) { /* dense block */ @@ -395,6 +392,7 @@ l2g_next_key(Local_to_global *l2g, Local_text_no lno) return binfo->key_block[i]; } } + binfo++; } /* @@ -402,7 +400,7 @@ l2g_next_key(Local_to_global *l2g, Local_text_no lno) * until there are no more blocks. Blocks can be completely * empty due to removals of entries. */ - while (++binfo <= l2g->blocks + l2g->num_blocks) { + for (; binfo < l2g->blocks + l2g->num_blocks; ++binfo) { /* If the block contains anything at all, get the item. */ if (binfo->zeroes < L2G_BLOCKSIZE){