X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=index%2Fkcompare.c;h=3fd1c7ee15055bee4b3b5d3b3243d2b3e4506524;hb=c66753469d139c4233a3572edf4b15b0497e0f28;hp=b53c516b758b7a1b066706587796850ae8ffc5d6;hpb=ecf94fc25324414287d3bbfbeba4440e558edd17;p=idzebra-moved-to-github.git diff --git a/index/kcompare.c b/index/kcompare.c index b53c516..3fd1c7e 100644 --- a/index/kcompare.c +++ b/index/kcompare.c @@ -1,5 +1,5 @@ -/* $Id: kcompare.c,v 1.56 2005-04-13 13:03:47 adam Exp $ - Copyright (C) 1995-2005 +/* $Id: kcompare.c,v 1.60 2006-08-14 10:40:15 adam Exp $ + Copyright (C) 1995-2006 Index Data ApS This file is part of the Zebra server. @@ -15,9 +15,9 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with Zebra; see the file LICENSE.zebra. If not, write to the -Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ #include @@ -33,9 +33,11 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #define CODEC_INLINE #endif -void key_logdump_txt (int logmask, const void *p, const char *txt) +void key_logdump_txt(int logmask, const void *p, const char *txt) { struct it_key key; + if (!txt) + txt = "(none)"; if (p) { char formstr[128]; @@ -50,13 +52,13 @@ void key_logdump_txt (int logmask, const void *p, const char *txt) strcat(formstr, "."); sprintf(formstr + strlen(formstr), ZINT_FORMAT, key.mem[i]); } - yaz_log (logmask, "%s %s", formstr, txt); + yaz_log(logmask, "%s %s", formstr, txt); } else - yaz_log(logmask, " (null) %s",txt); + yaz_log(logmask, " (no key) %s",txt); } -void key_logdump (int logmask, const void *p) +void key_logdump(int logmask, const void *p) { key_logdump_txt(logmask, p, ""); } @@ -116,6 +118,13 @@ zint key_get_seq(const void *p) return k.mem[k.len-1]; } +zint key_get_segment(const void *p) +{ + struct it_key k; + memcpy (&k, p, sizeof(k)); + return k.mem[k.len-1] / KEY_SEGMENT_SIZE; +} + int key_qsort_compare (const void *p1, const void *p2) { int r; @@ -336,3 +345,11 @@ int key_SU_decode (int *ch, const unsigned char *out) return len; } +/* + * Local variables: + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +