X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmatchstr.c;h=b3faae7e4302f52f0047e47b5ff862cee83a9dcd;hb=455798a3154b5c08c872ca0fb90607ddea575038;hp=2ec92d81f926396c83d1846119308a73c744abae;hpb=c6e47cbbff56f39f6d81b079ebaeac41d793d4d9;p=yaz-moved-to-github.git diff --git a/src/matchstr.c b/src/matchstr.c index 2ec92d8..b3faae7 100644 --- a/src/matchstr.c +++ b/src/matchstr.c @@ -1,10 +1,15 @@ /* - * Copyright (c) 1995-2003, Index Data. + * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. - * Sebastian Hammer, Adam Dickmeiss * - * $Id: matchstr.c,v 1.1 2003-10-27 12:21:31 adam Exp $ + * $Id: matchstr.c,v 1.5 2005-06-25 15:46:04 adam Exp $ */ + +/** + * \file matchstr.c + * \brief Implements loose string matching + */ + #if HAVE_CONFIG_H #include #endif @@ -25,28 +30,28 @@ int yaz_matchstr(const char *s1, const char *s2) { while (*s1 && *s2) { - char c1 = *s1; - char c2 = *s2; + unsigned char c1 = *s1; + unsigned char c2 = *s2; if (c2 == '?') return 0; - if (c1 == '-') - c1 = *++s1; - if (c2 == '-') - c2 = *++s2; - if (!c1 || !c2) - break; + if (c1 == '-') + c1 = *++s1; + if (c2 == '-') + c2 = *++s2; + if (!c1 || !c2) + break; if (c2 != '.') { - if (isupper(c1)) - c1 = tolower(c1); - if (isupper(c2)) - c2 = tolower(c2); - if (c1 != c2) - break; + if (isupper(c1)) + c1 = tolower(c1); + if (isupper(c2)) + c2 = tolower(c2); + if (c1 != c2) + break; } - s1++; - s2++; + s1++; + s2++; } return *s1 || *s2; } @@ -76,3 +81,11 @@ void __assert_fail (const char *assertion, const char *file, } #endif #endif +/* + * Local variables: + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +