From d446b1531b82def47b9b684517a7c629c7400aab Mon Sep 17 00:00:00 2001 From: Martin Baute Date: Fri, 8 Apr 2016 14:04:03 +0200 Subject: [PATCH] Moving branches closer together. --- functions/_PDCLIB/Readme.txt | 6 +++--- functions/_PDCLIB/{atomax.c => _PDCLIB_atomax.c} | 0 functions/_PDCLIB/{closeall.c => _PDCLIB_closeall.c} | 0 functions/_PDCLIB/{digits.c => _PDCLIB_digits.c} | 0 functions/_PDCLIB/{seed.c => _PDCLIB_seed.c} | 0 functions/_PDCLIB/{strtox_main.c => _PDCLIB_strtox_main.c} | 0 .../_PDCLIB/{strtox_prelim.c => _PDCLIB_strtox_prelim.c} | 0 functions/string/strcoll.c | 6 ++++-- functions/string/strxfrm.c | 3 ++- 9 files changed, 9 insertions(+), 6 deletions(-) rename functions/_PDCLIB/{atomax.c => _PDCLIB_atomax.c} (100%) rename functions/_PDCLIB/{closeall.c => _PDCLIB_closeall.c} (100%) rename functions/_PDCLIB/{digits.c => _PDCLIB_digits.c} (100%) rename functions/_PDCLIB/{seed.c => _PDCLIB_seed.c} (100%) rename functions/_PDCLIB/{strtox_main.c => _PDCLIB_strtox_main.c} (100%) rename functions/_PDCLIB/{strtox_prelim.c => _PDCLIB_strtox_prelim.c} (100%) diff --git a/functions/_PDCLIB/Readme.txt b/functions/_PDCLIB/Readme.txt index 5010942..13ad05c 100644 --- a/functions/_PDCLIB/Readme.txt +++ b/functions/_PDCLIB/Readme.txt @@ -3,8 +3,8 @@ This directory holds various "internals" of PDCLib: - definitions of helper functions not specified by the standard (hidden in the _PDCLIB_* namespace); -- definitions of data objects, both internal (like digits.c) and specified by - the standard (errno.c); +- definitions of data objects, both internal (like _PDCLIB_digits) and specified by + the standard (_PDCLIB_errno); - test drivers for functionality that does not have its own implementation - file to put the test driver in. + file to put the test driver in (stdarg). diff --git a/functions/_PDCLIB/atomax.c b/functions/_PDCLIB/_PDCLIB_atomax.c similarity index 100% rename from functions/_PDCLIB/atomax.c rename to functions/_PDCLIB/_PDCLIB_atomax.c diff --git a/functions/_PDCLIB/closeall.c b/functions/_PDCLIB/_PDCLIB_closeall.c similarity index 100% rename from functions/_PDCLIB/closeall.c rename to functions/_PDCLIB/_PDCLIB_closeall.c diff --git a/functions/_PDCLIB/digits.c b/functions/_PDCLIB/_PDCLIB_digits.c similarity index 100% rename from functions/_PDCLIB/digits.c rename to functions/_PDCLIB/_PDCLIB_digits.c diff --git a/functions/_PDCLIB/seed.c b/functions/_PDCLIB/_PDCLIB_seed.c similarity index 100% rename from functions/_PDCLIB/seed.c rename to functions/_PDCLIB/_PDCLIB_seed.c diff --git a/functions/_PDCLIB/strtox_main.c b/functions/_PDCLIB/_PDCLIB_strtox_main.c similarity index 100% rename from functions/_PDCLIB/strtox_main.c rename to functions/_PDCLIB/_PDCLIB_strtox_main.c diff --git a/functions/_PDCLIB/strtox_prelim.c b/functions/_PDCLIB/_PDCLIB_strtox_prelim.c similarity index 100% rename from functions/_PDCLIB/strtox_prelim.c rename to functions/_PDCLIB/_PDCLIB_strtox_prelim.c diff --git a/functions/string/strcoll.c b/functions/string/strcoll.c index 6b012b7..a139adb 100644 --- a/functions/string/strcoll.c +++ b/functions/string/strcoll.c @@ -12,12 +12,14 @@ int strcoll( const char * s1, const char * s2 ) { - while ( ( *s1 ) && ( _PDCLIB_lconv.ctype[(unsigned char)*s1].collation == _PDCLIB_lconv.ctype[(unsigned char)*s2].collation ) ) + const _PDCLIB_ctype_t * ctype = _PDCLIB_lconv.ctype; + + while ( ( *s1 ) && ( ctype[(unsigned char)*s1].collation == ctype[(unsigned char)*s2].collation ) ) { ++s1; ++s2; } - return ( _PDCLIB_lconv.ctype[(unsigned char)*s1].collation == _PDCLIB_lconv.ctype[(unsigned char)*s2].collation ); + return ( ctype[(unsigned char)*s1].collation == ctype[(unsigned char)*s2].collation ); } #endif diff --git a/functions/string/strxfrm.c b/functions/string/strxfrm.c index c16f1e0..c17d867 100644 --- a/functions/string/strxfrm.c +++ b/functions/string/strxfrm.c @@ -12,13 +12,14 @@ size_t strxfrm( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2, size_t n ) { + const _PDCLIB_ctype_t * ctype = _PDCLIB_lconv.ctype; size_t len = strlen( s2 ); if ( len < n ) { /* Cannot use strncpy() here as the filling of s1 with '\0' is not part of the spec. */ - while ( n-- && ( *s1++ = _PDCLIB_lconv.ctype[(unsigned char)*s2++].collation ) ); + while ( n-- && ( *s1++ = ctype[(unsigned char)*s2++].collation ) ); } return len; } -- 2.40.0