X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmatchstr.c;h=cd5af552cb2f55ac40d1f6e9af6f1cf81a8e43ea;hb=3a3c0ef92f785ff123069ea51ba0f8711b23dbf7;hp=b078150958fc975fa372d515df0b6442647d4ca0;hpb=ee6ab2ee3a9ee1a8c65d7272ec7fba1d886f5af0;p=yaz-moved-to-github.git diff --git a/src/matchstr.c b/src/matchstr.c index b078150..cd5af55 100644 --- a/src/matchstr.c +++ b/src/matchstr.c @@ -5,7 +5,7 @@ /** * \file matchstr.c - * \brief Implements loose string matching + * \brief a couple of string utilities */ #if HAVE_CONFIG_H @@ -16,7 +16,7 @@ #include #include #include -#include +#include int yaz_matchstr(const char *s1, const char *s2) { @@ -62,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