[PATCH 1/2] Add xstrtol() implementation.

Thierry Reding thierry.reding at avionic-design.de
Fri May 22 09:08:39 UTC 2009


Signed-off-by: Thierry Reding <thierry.reding at avionic-design.de>
---
 include/xatonum.h        |    4 ++++
 libbb/xatonum_template.c |    5 +++++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/include/xatonum.h b/include/xatonum.h
index ee816ef..864d2a3 100644
--- a/include/xatonum.h
+++ b/include/xatonum.h
@@ -22,6 +22,7 @@ unsigned type xato##UT##_sfx(const char *str, const struct suffix_mult *sfx) FAS
 unsigned type xato##UT(const char *str) FAST_FUNC; \
 type xstrto##T##_range_sfx(const char *str, int b, type l, type u, const struct suffix_mult *sfx) FAST_FUNC; \
 type xstrto##T##_range(const char *str, int b, type l, type u) FAST_FUNC; \
+type xstrto##T(const char *str, int b) FAST_FUNC; \
 type xato##T##_range_sfx(const char *str, type l, type u, const struct suffix_mult *sfx) FAST_FUNC; \
 type xato##T##_range(const char *str, type l, type u) FAST_FUNC; \
 type xato##T##_sfx(const char *str, const struct suffix_mult *sfx) FAST_FUNC; \
@@ -66,6 +67,9 @@ static ALWAYS_INLINE \
 narrow xstrto##N##_range(const char *str, int b, narrow l, narrow u) \
 { return xstrto##W##_range(str, b, l, u); } \
 static ALWAYS_INLINE \
+narrow xstrto##N(const char *str, int b) \
+{ return xstrto##W(str, b); } \
+static ALWAYS_INLINE \
 narrow xato##N##_range_sfx(const char *str, narrow l, narrow u, const struct suffix_mult *sfx) \
 { return xato##W##_range_sfx(str, l, u, sfx); } \
 static ALWAYS_INLINE \
diff --git a/libbb/xatonum_template.c b/libbb/xatonum_template.c
index 5e0bb59..339a7d3 100644
--- a/libbb/xatonum_template.c
+++ b/libbb/xatonum_template.c
@@ -157,6 +157,11 @@ type FAST_FUNC xstrto(_range)(const char *numstr, int base, type lower, type upp
 	return xstrto(_range_sfx)(numstr, base, lower, upper, NULL);
 }
 
+type FAST_FUNC xstrto()(const char *numstr, int base)
+{
+	return xstrto(_range_sfx)(numstr, base, XSTR_TYPE_MIN, XSTR_TYPE_MAX, NULL);
+}
+
 type FAST_FUNC xato(_range_sfx)(const char *numstr,
 		type lower,
 		type upper,
-- 
1.6.3.1



More information about the busybox mailing list