Mercurial > libjeffpc
changeset 668:81b0f68b1185
int: use str2uXX_base instead of calling __str2uXX directly
__str2uXX was never intended to be part of the API.
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Thu, 21 Feb 2019 18:25:21 -0500 |
parents | 4680ed53cac1 |
children | 83493acbd279 |
files | sexpr.l tests/test_str2uint.c |
diffstat | 2 files changed, 13 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/sexpr.l Thu Feb 21 14:21:11 2019 -0500 +++ b/sexpr.l Thu Feb 21 18:25:21 2019 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> + * Copyright (c) 2015-2019 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -46,7 +46,7 @@ { int ret; - ret = __str2u64(str, i, base); + ret = str2u64_base(str, i, base); if (ret) { char err[256]; @@ -113,7 +113,7 @@ ssize_t len; int ret; - ret = __str2u32(yytext + 2, &cp, 16); + ret = str2u32_base(yytext + 2, &cp, 16); if (ret) return ERROR;
--- a/tests/test_str2uint.c Thu Feb 21 14:21:11 2019 -0500 +++ b/tests/test_str2uint.c Thu Feb 21 18:25:21 2019 -0500 @@ -193,7 +193,7 @@ } \ fprintf(stderr, "..."); \ \ - check_rets(res->ret, ret, "__str2u%d", size); \ + check_rets(res->ret, ret, "str2u%d", size); \ \ if (!ret) \ ASSERT3U(out, ==, res->out); \ @@ -214,16 +214,16 @@ TEST(i, B10, SZ64, str2u64(in, &tmp), uint64_t); /* test underlying function with all bases */ - TEST(i, B8, SZ16, __str2u16(in, &tmp, 8), uint16_t); - TEST(i, B8, SZ32, __str2u32(in, &tmp, 8), uint32_t); - TEST(i, B8, SZ64, __str2u64(in, &tmp, 8), uint64_t); + TEST(i, B8, SZ16, str2u16_base(in, &tmp, 8), uint16_t); + TEST(i, B8, SZ32, str2u32_base(in, &tmp, 8), uint32_t); + TEST(i, B8, SZ64, str2u64_base(in, &tmp, 8), uint64_t); - TEST(i, B10, SZ16, __str2u16(in, &tmp, 10), uint16_t); - TEST(i, B10, SZ32, __str2u32(in, &tmp, 10), uint32_t); - TEST(i, B10, SZ64, __str2u64(in, &tmp, 10), uint64_t); + TEST(i, B10, SZ16, str2u16_base(in, &tmp, 10), uint16_t); + TEST(i, B10, SZ32, str2u32_base(in, &tmp, 10), uint32_t); + TEST(i, B10, SZ64, str2u64_base(in, &tmp, 10), uint64_t); - TEST(i, B16, SZ16, __str2u16(in, &tmp, 16), uint16_t); - TEST(i, B16, SZ32, __str2u32(in, &tmp, 16), uint32_t); - TEST(i, B16, SZ64, __str2u64(in, &tmp, 16), uint64_t); + TEST(i, B16, SZ16, str2u16_base(in, &tmp, 16), uint16_t); + TEST(i, B16, SZ32, str2u32_base(in, &tmp, 16), uint32_t); + TEST(i, B16, SZ64, str2u64_base(in, &tmp, 16), uint64_t); } }