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
Fix bug in rec_release_blocks that caused Zebra to halt.
[idzebra-moved-to-github.git]
/
index
/
kcompare.c
diff --git
a/index/kcompare.c
b/index/kcompare.c
index
406ea2c
..
d279b37
100644
(file)
--- a/
index/kcompare.c
+++ b/
index/kcompare.c
@@
-1,4
+1,4
@@
-/* $Id: kcompare.c,v 1.42 2004-05-30 18:35:12 adam Exp $
+/* $Id: kcompare.c,v 1.46.2.2 2004-08-06 09:36:07 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
@@
-28,15
+28,27
@@
Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "index.h"
#define INT_CODEC_NEW 0
#include "index.h"
#define INT_CODEC_NEW 0
-
+#ifdef __GNUC__
#define CODEC_INLINE inline
#define CODEC_INLINE inline
+#else
+#define CODEC_INLINE
+#endif
-void key_logdump (int logmask, const void *p)
+void key_logdump_txt (int logmask, const void *p, const char *txt)
{
struct it_key key;
{
struct it_key key;
+ if (p)
+ {
+ memcpy (&key, p, sizeof(key));
+ logf (logmask, "%7d:%-4d %s", key.sysno, key.seqno,txt);
+ }
+ else
+ logf(logmask, " (null) %s",txt);
+}
- memcpy (&key, p, sizeof(key));
- logf (logmask, "%7d s=%-4d", key.sysno, key.seqno);
+void key_logdump (int logmask, const void *p)
+{
+ key_logdump_txt(logmask,p,"");
}
int key_compare_it (const void *p1, const void *p2)
}
int key_compare_it (const void *p1, const void *p2)
@@
-87,6
+99,13
@@
int key_compare (const void *p1, const void *p2)
return 0;
}
return 0;
}
+int key_get_seq(const void *p)
+{
+ struct it_key k;
+ memcpy (&k, p, sizeof(k));
+ return k.seqno;
+}
+
int key_qsort_compare (const void *p1, const void *p2)
{
int r;
int key_qsort_compare (const void *p1, const void *p2)
{
int r;
@@
-106,8
+125,7
@@
struct iscz1_code_info {
struct it_key key;
};
struct it_key key;
};
-
-static void *iscz1_code_start (int mode)
+void *iscz1_code_start (int mode)
{
struct iscz1_code_info *p = (struct iscz1_code_info *)
xmalloc (sizeof(*p));
{
struct iscz1_code_info *p = (struct iscz1_code_info *)
xmalloc (sizeof(*p));
@@
-116,20
+134,20
@@
static void *iscz1_code_start (int mode)
return p;
}
return p;
}
-static void iscz1_code_reset (void *vp)
+void iscz1_code_reset (void *vp)
{
struct iscz1_code_info *p = (struct iscz1_code_info *) vp;
p->key.sysno = 0;
p->key.seqno = 0;
}
{
struct iscz1_code_info *p = (struct iscz1_code_info *) vp;
p->key.sysno = 0;
p->key.seqno = 0;
}
-static void iscz1_code_stop (int mode, void *p)
+void iscz1_code_stop (int mode, void *p)
{
xfree (p);
}
#if INT_CODEC_NEW
{
xfree (p);
}
#if INT_CODEC_NEW
-CODEC_INLINE void iscz1_encode_int (unsigned d, char **dst)
+static CODEC_INLINE void iscz1_encode_int (unsigned d, char **dst)
{
unsigned char *bp = (unsigned char*) *dst;
{
unsigned char *bp = (unsigned char*) *dst;
@@
-142,7
+160,7
@@
CODEC_INLINE void iscz1_encode_int (unsigned d, char **dst)
*dst = (char *) bp;
}
*dst = (char *) bp;
}
-CODEC_INLINE int iscz1_decode_int (unsigned char **src)
+static CODEC_INLINE int iscz1_decode_int (unsigned char **src)
{
unsigned d = 0;
unsigned char c;
{
unsigned d = 0;
unsigned char c;
@@
-159,7
+177,7
@@
CODEC_INLINE int iscz1_decode_int (unsigned char **src)
#else
/* ! INT_CODEC_NEW */
#else
/* ! INT_CODEC_NEW */
-CODEC_INLINE void iscz1_encode_int (unsigned d, char **dst)
+static CODEC_INLINE void iscz1_encode_int (unsigned d, char **dst)
{
unsigned char *bp = (unsigned char*) *dst;
{
unsigned char *bp = (unsigned char*) *dst;
@@
-186,7
+204,7
@@
CODEC_INLINE void iscz1_encode_int (unsigned d, char **dst)
*dst = (char *) bp;
}
*dst = (char *) bp;
}
-CODEC_INLINE int iscz1_decode_int (unsigned char **src)
+static CODEC_INLINE int iscz1_decode_int (unsigned char **src)
{
unsigned c = *(*src)++;
switch (c & 192)
{
unsigned c = *(*src)++;
switch (c & 192)
@@
-211,7
+229,7
@@
CODEC_INLINE int iscz1_decode_int (unsigned char **src)
}
#endif
}
#endif
-static void iscz1_code_item (int mode, void *vp, char **dst, char **src)
+void iscz1_code_item (int mode, void *vp, char **dst, char **src)
{
struct iscz1_code_info *p = (struct iscz1_code_info *) vp;
struct it_key tkey;
{
struct iscz1_code_info *p = (struct iscz1_code_info *) vp;
struct it_key tkey;
@@
-255,6
+273,7
@@
ISAMS_M *key_isams_m (Res res, ISAMS_M *me)
isams_getmethod (me);
me->compare_item = key_compare;
isams_getmethod (me);
me->compare_item = key_compare;
+ me->log_item = key_logdump_txt;
me->code_start = iscz1_code_start;
me->code_item = iscz1_code_item;
me->code_start = iscz1_code_start;
me->code_item = iscz1_code_item;
@@
-270,6
+289,7
@@
ISAMC_M *key_isamc_m (Res res, ISAMC_M *me)
isc_getmethod (me);
me->compare_item = key_compare;
isc_getmethod (me);
me->compare_item = key_compare;
+ me->log_item = key_logdump_txt;
me->code_start = iscz1_code_start;
me->code_item = iscz1_code_item;
me->code_start = iscz1_code_start;
me->code_item = iscz1_code_item;
@@
-286,6
+306,7
@@
ISAMD_M *key_isamd_m (Res res, ISAMD_M *me)
me = isamd_getmethod (me);
me->compare_item = key_compare;
me = isamd_getmethod (me);
me->compare_item = key_compare;
+ me->log_item = key_logdump_txt;
me->code_start = iscz1_code_start;
me->code_item = iscz1_code_item;
me->code_start = iscz1_code_start;
me->code_item = iscz1_code_item;