From 1e58ebd4607490d810c7396a4e87eb70d9528166 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Sun, 2 Jan 2005 18:51:31 +0000 Subject: [PATCH] Swap functions - minor changes to compare tst function --- isamb/tstisamb.c | 149 +++++++++++++++++++++++++++++------------------------- 1 file changed, 80 insertions(+), 69 deletions(-) diff --git a/isamb/tstisamb.c b/isamb/tstisamb.c index 67e3336..17f2a38 100644 --- a/isamb/tstisamb.c +++ b/isamb/tstisamb.c @@ -1,5 +1,5 @@ -/* $Id: tstisamb.c,v 1.13 2004-12-13 20:51:31 adam Exp $ - Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 +/* $Id: tstisamb.c,v 1.14 2005-01-02 18:51:31 adam Exp $ + Copyright (C) 1995-2005 Index Data Aps This file is part of the Zebra server. @@ -44,7 +44,11 @@ int compare_item(const void *a, const void *b) memcpy(&ia, a, sizeof(int)); memcpy(&ib, b, sizeof(int)); - return ia - ib; + if (ia > ib) + return 1; + if (ia < ib) + return -1; + return 0; } void *code_start() @@ -84,67 +88,11 @@ int code_read(void *vp, char **dst, int *insertMode) memcpy (*dst, &x, sizeof(int)); (*dst)+=sizeof(int); - ri->no += ri->step; + ri->no = ri->no + ri->step; *insertMode = ri->insertMode; return 1; } -void tst_forward(ISAMB isb, int n) -{ - ISAMC_I isamc_i; - ISAMC_P isamc_p; - struct read_info ri; - int i; - ISAMB_PP pp; - - /* insert a number of entries */ - ri.no = 0; - ri.step = 1; - ri.max = n; - ri.insertMode = 1; - - isamc_i.clientData = &ri; - isamc_i.read_item = code_read; - - isamc_p = isamb_merge (isb, 0 /* new list */ , &isamc_i); - - /* read the entries */ - pp = isamb_pp_open (isb, isamc_p, 2); - - for (i = 0; i