+ else if (zi->reg->isamb)
+ {
+ ISAMB_PP *ispt;
+ int i;
+ struct trunc_info *ti;
+
+ ispt = (ISAMB_PP *) xmalloc (sizeof(*ispt) * (to-from));
+
+ ti = heap_init (to-from, sizeof(struct it_key),
+ key_compare_it);
+ for (i = to-from; --i >= 0; )
+ {
+ if (isam_p[from+i]) {
+ ispt[i] = isamb_pp_open (zi->reg->isamb, isam_p[from+i], scope);
+ if (isamb_pp_read (ispt[i], ti->tmpbuf))
+ heap_insert (ti, ti->tmpbuf, i);
+ else
+ isamb_pp_close (ispt[i]);
+ }
+ }
+ while (ti->heapnum)
+ {
+ int n = ti->indx[ti->ptr[1]];
+
+ rset_write (result_rsfd, ti->heap[ti->ptr[1]]);
+ nn++;
+
+ if (preserve_position)
+ {
+ heap_delete (ti);
+ if (isamb_pp_read (ispt[n], ti->tmpbuf))
+ heap_insert (ti, ti->tmpbuf, n);
+ else
+ isamb_pp_close (ispt[n]);
+ }
+ else
+ {
+ while (1)
+ {
+ if (!isamb_pp_read (ispt[n], ti->tmpbuf))
+ {
+ heap_delete (ti);
+ isamb_pp_close (ispt[n]);
+ break;
+ }
+ if ((*ti->cmp)(ti->tmpbuf, ti->heap[ti->ptr[1]]) > 1)
+ {
+ heap_delete (ti);
+ heap_insert (ti, ti->tmpbuf, n);
+ break;
+ }
+ }
+ }
+ }
+ heap_close (ti);
+ xfree (ispt);
+ }
+ else
+ logf (LOG_WARN, "Unknown isam set in rset_trunc_r");
+
+ rset_close (result_rsfd);