You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openwrt/package/network/utils/nftables/patches/202-datatype-use-mpz_set_st...

29 lines
878 B
Diff

From 23e8958a5e539f682be4cbdf5196aa2014c7e295 Mon Sep 17 00:00:00 2001
From: Steven Barth <cyrus@openwrt.org>
Date: Mon, 15 Dec 2014 14:09:27 +0100
Subject: [PATCH 2/5] datatype: use mpz_set_str instead of gmp_sscanf
This simplifies the integer parsing logic and restricts it to
functions being part of the mini-gmp subset.
Signed-off-by: Steven Barth <cyrus@openwrt.org>
---
src/datatype.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
--- a/src/datatype.c
+++ b/src/datatype.c
@@ -275,11 +275,9 @@ static struct error_record *integer_type
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);