build: add version number to filenames
[openwrt/svn-archive/archive.git] / package / network / utils / nftables / patches / 202-datatype-use-mpz_set_str-instead-of-gmp_sscanf.patch
1 From 23e8958a5e539f682be4cbdf5196aa2014c7e295 Mon Sep 17 00:00:00 2001
2 From: Steven Barth <cyrus@openwrt.org>
3 Date: Mon, 15 Dec 2014 14:09:27 +0100
4 Subject: [PATCH 2/5] datatype: use mpz_set_str instead of gmp_sscanf
5
6 This simplifies the integer parsing logic and restricts it to
7 functions being part of the mini-gmp subset.
8
9 Signed-off-by: Steven Barth <cyrus@openwrt.org>
10 ---
11 src/datatype.c | 4 +---
12 1 file changed, 1 insertion(+), 3 deletions(-)
13
14 --- a/src/datatype.c
15 +++ b/src/datatype.c
16 @@ -275,11 +275,9 @@ static struct error_record *integer_type
17 struct expr **res)
18 {
19 mpz_t v;
20 - int len;
21
22 mpz_init(v);
23 - if (gmp_sscanf(sym->identifier, "%Zu%n", v, &len) != 1 ||
24 - (int)strlen(sym->identifier) != len) {
25 + if (mpz_set_str(v, sym->identifier, 0)) {
26 mpz_clear(v);
27 return error(&sym->location, "Could not parse %s",
28 sym->dtype->desc);