X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;ds=sidebyside;f=functions%2Fstdlib%2Fbsearch.c;h=b9a33c65064fc64fd11470b4f58ed504e10da909;hb=12e17136786afb1775c9dc946cbe41f5e230c24a;hp=881c99af99e5414bd58def477d76abcd7afe2d85;hpb=9489b93733c00be5a94e2ee5b349457c78184a1a;p=pdclib.old diff --git a/functions/stdlib/bsearch.c b/functions/stdlib/bsearch.c index 881c99a..b9a33c6 100644 --- a/functions/stdlib/bsearch.c +++ b/functions/stdlib/bsearch.c @@ -42,14 +42,13 @@ void * bsearch( const void * key, const void * base, size_t nmemb, size_t size, #ifdef TEST #include <_PDCLIB_test.h> -int compare( const void * left, const void * right ) +static int compare( const void * left, const void * right ) { return *( (unsigned char *)left ) - *( (unsigned char *)right ); } -int main() +int main( void ) { - BEGIN_TESTS; TESTCASE( bsearch( "e", abcde, 4, 1, compare ) == NULL ); TESTCASE( bsearch( "e", abcde, 5, 1, compare ) == &abcde[4] ); TESTCASE( bsearch( "a", abcde + 1, 4, 1, compare ) == NULL );