X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmatchstr.c;h=e2a1da3579ad5552623cc2dbc0d45b3bccf3b3cb;hb=2ba84b155219d5d18eed5ba4d929c12abdb88f14;hp=b3faae7e4302f52f0047e47b5ff862cee83a9dcd;hpb=fb6d99a0c7e07d9cc4a315c447deaf6564a85505;p=yaz-moved-to-github.git diff --git a/src/matchstr.c b/src/matchstr.c index b3faae7..e2a1da3 100644 --- a/src/matchstr.c +++ b/src/matchstr.c @@ -1,8 +1,6 @@ -/* - * Copyright (C) 1995-2005, Index Data ApS +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2008 Index Data * See the file LICENSE for details. - * - * $Id: matchstr.c,v 1.5 2005-06-25 15:46:04 adam Exp $ */ /** @@ -20,12 +18,6 @@ #include #include -/* - * Match strings, independently of case and occurences of '-'. - * fairly inefficient - will be replaced with an indexing scheme for - * the various subsystems if we get a bottleneck here. - */ - int yaz_matchstr(const char *s1, const char *s2) { while (*s1 && *s2) @@ -70,17 +62,15 @@ int yaz_strcmp_del(const char *a, const char *b, const char *b_del) return *a - *b; } -#ifdef __GNUC__ -#ifdef __CHECKER__ -void __assert_fail (const char *assertion, const char *file, - unsigned int line, const char *function) +int yaz_memcmp(const void *a, const void *b, size_t len_a, size_t len_b) { - fprintf (stderr, "%s in file %s line %d func %s\n", - assertion, file, line, function); - abort (); + size_t m_len = len_a < len_b ? len_a : len_b; + int r = memcmp(a, b, m_len); + if (r) + return r; + return len_a - len_b; } -#endif -#endif + /* * Local variables: * c-basic-offset: 4