[PATCH 2/5] datatype: use mpz_set_str instead of gmp_sscanf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This simplifies the integer parsing logic and restricts it to
functions being part of the mini-gmp subset.

Signed-off-by: Steven Barth <cyrus@xxxxxxxxxxx>
---
 src/datatype.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/datatype.c b/src/datatype.c
index 2a9fcdb..76f2af1 100644
--- a/src/datatype.c
+++ b/src/datatype.c
@@ -276,11 +276,9 @@ static struct error_record *integer_type_parse(const struct expr *sym,
 					       struct expr **res)
 {
 	mpz_t v;
-	int len;
 
 	mpz_init(v);
-	if (gmp_sscanf(sym->identifier, "%Zu%n", v, &len) != 1 ||
-	    (int)strlen(sym->identifier) != len) {
+	if (mpz_set_str(v, sym->identifier, 0)) {
 		mpz_clear(v);
 		return error(&sym->location, "Could not parse %s",
 			     sym->dtype->desc);
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux