summaryrefslogtreecommitdiffstats
path: root/libnumtext_num2text.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-09-08 23:24:34 +0200
committerMattias Andrée <maandree@kth.se>2021-09-08 23:24:39 +0200
commit84b8038689a1b289aeaf0efb2c0545dec79c1888 (patch)
treec81de8773a3b09e137b82ca1686dc23e31118fda /libnumtext_num2text.c
parentFix typo (diff)
downloadlibnumtext-84b8038689a1b289aeaf0efb2c0545dec79c1888.tar.gz
libnumtext-84b8038689a1b289aeaf0efb2c0545dec79c1888.tar.bz2
libnumtext-84b8038689a1b289aeaf0efb2c0545dec79c1888.tar.xz
misc
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--libnumtext_num2text.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/libnumtext_num2text.c b/libnumtext_num2text.c
index 50dc6ca..25c5429 100644
--- a/libnumtext_num2text.c
+++ b/libnumtext_num2text.c
@@ -14,13 +14,11 @@ libnumtext_num2text(char *outbuf, size_t outbuf_size, const char *num, size_t nu
params.trailing_zeroes = 0;
i = 0;
- if (i < num_len) {
- if (num[i] == '+' || num[i] == '-') {
+ if (num_len) {
+ if (num[0] == '+' || num[0] == '-')
i += 1;
- } else if (num_len >= sizeof(UNICODE_MINUS)) {
- if (!strncmp(&num[0], UNICODE_MINUS, sizeof(UNICODE_MINUS) - 1))
- i += sizeof(UNICODE_MINUS) - 1;
- }
+ else if (IS_UNICODE_MINUS(num, num_len))
+ i += sizeof(UNICODE_MINUS) - 1;
}
params.sign_length = i;
if (i == num_len)