X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=util%2Fit_key.c;h=4e82c8b636b8fdd0275d03832dc9a6b25ba796e1;hb=36b87ab1076744bf0438799bb375705f535bcb6b;hp=cd4211e309b87a8d8ba646b1bd230926a17650c3;hpb=89d3a004b7c651fd5673abfc192e1472dc4d4197;p=idzebra-moved-to-github.git diff --git a/util/it_key.c b/util/it_key.c index cd4211e..4e82c8b 100644 --- a/util/it_key.c +++ b/util/it_key.c @@ -1,8 +1,5 @@ -/* $Id: it_key.c,v 1.2 2007-01-15 15:10:26 adam Exp $ - Copyright (C) 1995-2007 - Index Data ApS - -This file is part of the Zebra server. +/* This file is part of the Zebra server. + Copyright (C) Index Data Zebra is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -20,6 +17,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#if HAVE_CONFIG_H +#include +#endif #include #include #include @@ -64,25 +64,6 @@ void key_logdump(int logmask, const void *p) key_logdump_txt(logmask, p, ""); } -int key_compare_it (const void *p1, const void *p2) -{ - int i, l = ((struct it_key *) p1)->len; - if (((struct it_key *) p2)->len > l) - l = ((struct it_key *) p2)->len; - assert (l <= IT_KEY_LEVEL_MAX && l > 0); - for (i = 0; i < l; i++) - { - if (((struct it_key *) p1)->mem[i] != ((struct it_key *) p2)->mem[i]) - { - if (((struct it_key *) p1)->mem[i] > ((struct it_key *) p2)->mem[i]) - return l-i; - else - return i-l; - } - } - return 0; -} - char *key_print_it (const void *p, char *buf) { strcpy(buf, ""); @@ -132,7 +113,7 @@ int key_qsort_compare (const void *p1, const void *p2) size_t l; char *cp1 = *(char **) p1; char *cp2 = *(char **) p2; - + if ((r = strcmp (cp1, cp2))) return r; l = strlen(cp1)+1; @@ -216,7 +197,7 @@ void iscz1_encode (void *vp, char **dst, const char **src) 3, 2, 9, 12 3, 2, 10, 2 4, 1 - + if diff is 0, then there is more ... if diff is non-zero, then _may_ be more */ @@ -274,6 +255,7 @@ void iscz1_decode (void *vp, char **dst, const char **src) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab