Skip to content

Commit d6cb87a

Browse files
committed
add option to use standard strlen() instead of home-baked version
Signed-off-by: Steffen Jaeckel <[email protected]>
1 parent 646697a commit d6cb87a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

mp_read_radix.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
44
/* SPDX-License-Identifier: Unlicense */
55

6+
#ifdef MP_USE_MEMOPS
7+
# include <string.h>
8+
9+
# define MP_STRLEN(s) strlen(s)
10+
#else
611
static size_t s_mp_strlen(const char *s)
712
{
813
const char *p;
@@ -12,6 +17,8 @@ static size_t s_mp_strlen(const char *s)
1217
}
1318
return (size_t)(p - s);
1419
}
20+
# define MP_STRLEN(s) s_mp_strlen(s)
21+
#endif
1522

1623
/* read a string [ASCII] in a given radix */
1724
mp_err mp_read_radix(mp_int *a, const char *str, int radix)
@@ -34,7 +41,7 @@ mp_err mp_read_radix(mp_int *a, const char *str, int radix)
3441
sign = MP_NEG;
3542
}
3643

37-
slen = s_mp_strlen(str);
44+
slen = MP_STRLEN(str);
3845

3946
mp_zero(a);
4047

0 commit comments

Comments
 (0)