diff options
Diffstat (limited to 'src/u8c/u32sz.c')
-rw-r--r-- | src/u8c/u32sz.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/u8c/u32sz.c b/src/u8c/u32sz.c index ca8b1be..9dc2108 100644 --- a/src/u8c/u32sz.c +++ b/src/u8c/u32sz.c @@ -14,20 +14,18 @@ If not, see <https://www.gnu.org/licenses/>. */ # include <assert.h> +# include <stdbool.h> # include <stddef.h> -# include <stdint.h> -# include <u8c/seterr.h> # include <u8c/SIZE_C.h> +# include <u8c/u32fndchr.h> # include <u8c/u32sz.h> -uint_least8_t u8c_u32sz(size_t * const _sz,uint_least32_t const * const _u32) { +# include <uchar.h> +bool u8c_u32sz(size_t * const _sz,char32_t const * const _in) { assert(_sz != NULL); - assert(_u32 != NULL); - for(register size_t n = SIZE_C(0x0);n <= SIZE_MAX;n += SIZE_C(0x1)) { - if(_u32[n] == UINT32_C(0x0)) { - *_sz = n + SIZE_C(0x1); - return UINT8_C(0x0); - } + size_t sz = SIZE_C(0x0); + if(u8c_u32fndchr(&sz,_in,U'\0')) { + return true; } - u8c_seterr((uint_least32_t[]){UINT32_C(0x75),UINT32_C(0x38),UINT32_C(0x63),UINT32_C(0x5F),UINT32_C(0x75),UINT32_C(0x33),UINT32_C(0x32),UINT32_C(0x73),UINT32_C(0x7A),UINT32_C(0x3A),UINT32_C(0x20),UINT32_C(0x55),UINT32_C(0x6E),UINT32_C(0x74),UINT32_C(0x65),UINT32_C(0x72),UINT32_C(0x6D),UINT32_C(0x69),UINT32_C(0x6E),UINT32_C(0x61),UINT32_C(0x74),UINT32_C(0x65),UINT32_C(0x64),UINT32_C(0x20),UINT32_C(0x69),UINT32_C(0x6E),UINT32_C(0x70),UINT32_C(0x75),UINT32_C(0x74),UINT32_C(0x2E),UINT32_C(0x0),}); /* u8c_u32sz: Unterminated input. */ - return UINT8_C(0x1); + *_sz = sz; + return true; } |