From 4cdd6f2ea0af64843082c05147c307eb62165352 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Tue, 27 Jun 2023 21:16:11 +0200 Subject: [PATCH] Filter: Remove number of args from METHOD_R() Macro METHOD_R() is used for simplest methods, there is no place to define argument types, so let's force it to be 0. --- filter/decl.m4 | 2 +- filter/f-inst.c | 36 ++++++++++++++++++------------------ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/filter/decl.m4 b/filter/decl.m4 index d292f65b..cc5e9d8e 100644 --- a/filter/decl.m4 +++ b/filter/decl.m4 @@ -305,7 +305,7 @@ INST([[FI_METHOD__]]$1[[__]]$2, m4_eval($3 + 1), 1) { METHOD_CONSTRUCTOR("$2"); }') -m4_define(METHOD_R, `METHOD($1, $2, $3, [[ RESULT($4, $5, $6) ]])') +m4_define(METHOD_R, `METHOD($1, $2, 0, [[ RESULT($3, $4, $5) ]])') # 2) Code wrapping # The code produced in 1xx temporary diversions is a raw code without diff --git a/filter/f-inst.c b/filter/f-inst.c index 6977f656..434869c5 100644 --- a/filter/f-inst.c +++ b/filter/f-inst.c @@ -496,8 +496,8 @@ RESULT(T_BOOL, i, (v1.type != T_VOID) && !undef_value(v1)); } - METHOD_R(T_NET, type, 0, T_ENUM_NETTYPE, i, v1.val.net->type); - METHOD_R(T_IP, is_v4, 0, T_BOOL, i, ipa_is_ip4(v1.val.ip)); + METHOD_R(T_NET, type, T_ENUM_NETTYPE, i, v1.val.net->type); + METHOD_R(T_IP, is_v4, T_BOOL, i, ipa_is_ip4(v1.val.ip)); /* Add initialized variable */ INST(FI_VAR_INIT, 1, 0) { @@ -553,10 +553,10 @@ RESULT_VAL(val); } - METHOD_R(T_PATH, empty, 0, T_PATH, ad, &null_adata); - METHOD_R(T_CLIST, empty, 0, T_CLIST, ad, &null_adata); - METHOD_R(T_ECLIST, empty, 0, T_ECLIST, ad, &null_adata); - METHOD_R(T_LCLIST, empty, 0, T_LCLIST, ad, &null_adata); + METHOD_R(T_PATH, empty, T_PATH, ad, &null_adata); + METHOD_R(T_CLIST, empty, T_CLIST, ad, &null_adata); + METHOD_R(T_ECLIST, empty, T_ECLIST, ad, &null_adata); + METHOD_R(T_LCLIST, empty, T_LCLIST, ad, &null_adata); /* Common loop begin instruction, always created by f_for_cycle() */ INST(FI_FOR_LOOP_START, 0, 3) { @@ -946,11 +946,11 @@ } /* Get length of */ - METHOD_R(T_NET, len, 0, T_INT, i, net_pxlen(v1.val.net)); - METHOD_R(T_PATH, len, 0, T_INT, i, as_path_getlen(v1.val.ad)); - METHOD_R(T_CLIST, len, 0, T_INT, i, int_set_get_size(v1.val.ad)); - METHOD_R(T_ECLIST, len, 0, T_INT, i, ec_set_get_size(v1.val.ad)); - METHOD_R(T_LCLIST, len, 0, T_INT, i, lc_set_get_size(v1.val.ad)); + METHOD_R(T_NET, len, T_INT, i, net_pxlen(v1.val.net)); + METHOD_R(T_PATH, len, T_INT, i, as_path_getlen(v1.val.ad)); + METHOD_R(T_CLIST, len, T_INT, i, int_set_get_size(v1.val.ad)); + METHOD_R(T_ECLIST, len, T_INT, i, ec_set_get_size(v1.val.ad)); + METHOD_R(T_LCLIST, len, T_INT, i, lc_set_get_size(v1.val.ad)); INST(FI_NET_SRC, 1, 1) { /* Get src prefix */ ARG(1, T_NET); @@ -1035,8 +1035,8 @@ ]]); /* Get ROA ASN or community ASN part */ - METHOD_R(T_PAIR, asn, 0, T_INT, i, v1.val.i >> 16); - METHOD_R(T_LC, asn, 0, T_INT, i, v1.val.lc.asn); + METHOD_R(T_PAIR, asn, T_INT, i, v1.val.i >> 16); + METHOD_R(T_LC, asn, T_INT, i, v1.val.lc.asn); METHOD(T_NET, asn, 0, [[ if (!net_is_roa(v1.val.net)) @@ -1049,7 +1049,7 @@ /* Convert prefix to IP */ - METHOD_R(T_NET, ip, 0, T_IP, ip, net_prefix(v1.val.net)); + METHOD_R(T_NET, ip, T_IP, ip, net_prefix(v1.val.net)); INST(FI_ROUTE_DISTINGUISHER, 1, 1) { ARG(1, T_NET); @@ -1076,16 +1076,16 @@ } /* Get last ASN from non-aggregated part of AS PATH */ - METHOD_R(T_PATH, last_nonaggregated, 0, T_INT, i, as_path_get_last_nonaggregated(v1.val.ad)); + METHOD_R(T_PATH, last_nonaggregated, T_INT, i, as_path_get_last_nonaggregated(v1.val.ad)); /* Get data part from the standard community */ - METHOD_R(T_PAIR, data, 0, T_INT, i, v1.val.i & 0xFFFF); + METHOD_R(T_PAIR, data, T_INT, i, v1.val.i & 0xFFFF); /* Get data1 part from the large community */ - METHOD_R(T_LC, data1, 0, T_INT, i, v1.val.lc.ldp1); + METHOD_R(T_LC, data1, T_INT, i, v1.val.lc.ldp1); /* Get data2 part from the large community */ - METHOD_R(T_LC, data2, 0, T_INT, i, v1.val.lc.ldp2); + METHOD_R(T_LC, data2, T_INT, i, v1.val.lc.ldp2); INST(FI_CLIST_MIN, 1, 1) { /* Get minimum element from list */ ARG(1, T_CLIST);