X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fwchar%2Fwmemcmp.c;h=de5d49afd2ee533114b18dfa5713becd57e779a5;hp=15401166120d6242708aefedaf3a8ccb23f5849e;hb=abc15df6b9fae3374d24c7cf5c3ab94c605b2a6d;hpb=8894c921674bb116d0a7b8f23a55311e7a768019 diff --git a/functions/wchar/wmemcmp.c b/functions/wchar/wmemcmp.c index 1540116..de5d49a 100644 --- a/functions/wchar/wmemcmp.c +++ b/functions/wchar/wmemcmp.c @@ -1,39 +1,39 @@ -/* wmemcmp( const wchar_t *, const wchar_t *, size_t ) - - This file is part of the Public Domain C Library (PDCLib). - Permission is granted to use, modify, and / or redistribute at will. -*/ - -#include - -#ifndef REGTEST - -int wmemcmp( const wchar_t * p1, const wchar_t * p2, size_t n ) -{ - while ( n-- ) - { - if ( *p1 != *p2 ) - { - return *p1 - *p2; - } - ++p1; - ++p2; - } - return 0; -} - -#endif - -#ifdef TEST -#include "_PDCLIB_test.h" - -int main( void ) -{ - wchar_t const xxxxx[] = L"xxxxx"; - TESTCASE( wmemcmp( wabcde, wabcdx, 5 ) < 0 ); - TESTCASE( wmemcmp( wabcde, wabcdx, 4 ) == 0 ); - TESTCASE( wmemcmp( wabcde, xxxxx, 0 ) == 0 ); - TESTCASE( wmemcmp( xxxxx, wabcde, 1 ) > 0 ); - return 0; -} -#endif +/* wmemcmp( const wchar_t *, const wchar_t *, size_t ) + + This file is part of the Public Domain C Library (PDCLib). + Permission is granted to use, modify, and / or redistribute at will. +*/ + +#include + +#ifndef REGTEST + +int wmemcmp( const wchar_t * p1, const wchar_t * p2, size_t n ) +{ + while ( n-- ) + { + if ( *p1 != *p2 ) + { + return *p1 - *p2; + } + ++p1; + ++p2; + } + return 0; +} + +#endif + +#ifdef TEST +#include "_PDCLIB_test.h" + +int main( void ) +{ + wchar_t const xxxxx[] = L"xxxxx"; + TESTCASE( wmemcmp( wabcde, wabcdx, 5 ) < 0 ); + TESTCASE( wmemcmp( wabcde, wabcdx, 4 ) == 0 ); + TESTCASE( wmemcmp( wabcde, xxxxx, 0 ) == 0 ); + TESTCASE( wmemcmp( xxxxx, wabcde, 1 ) > 0 ); + return 0; +} +#endif