# HG changeset patch # User websnarf <github@azillionmonkeys.com> # Date 1461195187 25200 # Wed Apr 20 16:33:07 2016 -0700 # Node ID a66432562473e5be3f4f20ff99241f4250cbf2c7 # Parent c2cbbf63df07aacad2e8ed69ea9b7c794d33dec8 Implement biseqcaseless on top of biseqcaselessblk. Add missing documentation credit. diff --git a/bstrlib.c b/bstrlib.c --- a/bstrlib.c +++ b/bstrlib.c @@ -557,7 +557,7 @@ a->slen = i; len = strlen (str + i); - if (len + 1 > INT_MAX - i || + if (len + 1 > (size_t) INT_MAX - i || 0 > balloc (a, (int) (i + len + 1))) return BSTR_ERR; bBlockCopy (a->data + i, str + i, (size_t) len + 1); a->slen += (int) len; @@ -739,24 +739,8 @@ * termination characters are not treated in any special way. */ int biseqcaseless (const_bstring b0, const_bstring b1) { -#if 0 -int i, n; - - if (bdata (b0) == NULL || b0->slen < 0 || - bdata (b1) == NULL || b1->slen < 0) return BSTR_ERR; - if (b0->slen != b1->slen) return BSTR_OK; - if (b0->data == b1->data || b0->slen == 0) return 1; - for (i=0, n=b0->slen; i < n; i++) { - if (b0->data[i] != b1->data[i]) { - unsigned char c = (unsigned char) downcase (b0->data[i]); - if (c != (unsigned char) downcase (b1->data[i])) return 0; - } - } - return 1; -#else if (NULL == b1) return BSTR_ERR; return biseqcaselessblk (b0, b1->data, b1->slen); -#endif } /* int bisstemeqcaselessblk (const_bstring b0, const void * blk, int len) diff --git a/bstrlib.txt b/bstrlib.txt --- a/bstrlib.txt +++ b/bstrlib.txt @@ -3504,6 +3504,7 @@ Manuel Woelker Marcel van Kervinck Michael Hsieh +Mike Steinert Richard A. Smith Simon Ekstrom Wayne Scott