netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Álvaro Neira Ayuso" <alvaroneay@gmail.com>
To: Patrick McHardy <kaber@trash.net>, pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] dtype: remove unnecessary icmp* parse/print functions
Date: Thu, 11 Dec 2014 00:48:10 +0100	[thread overview]
Message-ID: <5488DBBA.40002@gmail.com> (raw)
In-Reply-To: <1418249676-22300-1-git-send-email-kaber@trash.net>

El 10/12/14 a las 23:14, Patrick McHardy escribió:
> Just setting the .sym_tbl correctly is all we need.

Looks good to me and so smart. I didn't know that if we set up the 
.sym_tbl, we don't need the parse and print functions. Thanks Patrick.

>
> Signed-off-by: Patrick McHardy <kaber@trash.net>
> ---
>   src/datatype.c | 42 +++---------------------------------------
>   1 file changed, 3 insertions(+), 39 deletions(-)
>
> diff --git a/src/datatype.c b/src/datatype.c
> index 729e63b..db3fb06 100644
> --- a/src/datatype.c
> +++ b/src/datatype.c
> @@ -709,17 +709,6 @@ static const struct symbol_table icmp_code_tbl = {
>   	},
>   };
>
> -static void icmp_code_type_print(const struct expr *expr)
> -{
> -	return symbolic_constant_print(&icmp_code_tbl, expr);
> -}
> -
> -static struct error_record *icmp_code_type_parse(const struct expr *sym,
> -						 struct expr **res)
> -{
> -	return symbolic_constant_parse(sym, &icmp_code_tbl, res);
> -}
> -
>   const struct datatype icmp_code_type = {
>   	.type		= TYPE_ICMP_CODE,
>   	.name		= "icmp_code",
> @@ -727,8 +716,7 @@ const struct datatype icmp_code_type = {
>   	.size		= BITS_PER_BYTE,
>   	.byteorder	= BYTEORDER_BIG_ENDIAN,
>   	.basetype	= &integer_type,
> -	.print		= icmp_code_type_print,
> -	.parse		= icmp_code_type_parse,
> +	.sym_tbl	= &icmp_code_tbl,
>   };
>
>   static const struct symbol_table icmpv6_code_tbl = {
> @@ -741,17 +729,6 @@ static const struct symbol_table icmpv6_code_tbl = {
>   	},
>   };
>
> -static void icmpv6_code_type_print(const struct expr *expr)
> -{
> -	return symbolic_constant_print(&icmpv6_code_tbl, expr);
> -}
> -
> -static struct error_record *icmpv6_code_type_parse(const struct expr *sym,
> -						   struct expr **res)
> -{
> -	return symbolic_constant_parse(sym, &icmpv6_code_tbl, res);
> -}
> -
>   const struct datatype icmpv6_code_type = {
>   	.type		= TYPE_ICMPV6_CODE,
>   	.name		= "icmpv6_code",
> @@ -759,8 +736,7 @@ const struct datatype icmpv6_code_type = {
>   	.size		= BITS_PER_BYTE,
>   	.byteorder	= BYTEORDER_BIG_ENDIAN,
>   	.basetype	= &integer_type,
> -	.print		= icmpv6_code_type_print,
> -	.parse		= icmpv6_code_type_parse,
> +	.sym_tbl	= &icmpv6_code_tbl,
>   };
>
>   static const struct symbol_table icmpx_code_tbl = {
> @@ -773,17 +749,6 @@ static const struct symbol_table icmpx_code_tbl = {
>   	},
>   };
>
> -static void icmpx_code_type_print(const struct expr *expr)
> -{
> -	return symbolic_constant_print(&icmpx_code_tbl, expr);
> -}
> -
> -static struct error_record *icmpx_code_type_parse(const struct expr *sym,
> -						  struct expr **res)
> -{
> -	return symbolic_constant_parse(sym, &icmpx_code_tbl, res);
> -}
> -
>   const struct datatype icmpx_code_type = {
>   	.type		= TYPE_ICMPX_CODE,
>   	.name		= "icmpx_code",
> @@ -791,8 +756,7 @@ const struct datatype icmpx_code_type = {
>   	.size		= BITS_PER_BYTE,
>   	.byteorder	= BYTEORDER_BIG_ENDIAN,
>   	.basetype	= &integer_type,
> -	.print		= icmpx_code_type_print,
> -	.parse		= icmpx_code_type_parse,
> +	.sym_tbl	= &icmpx_code_tbl,
>   };
>
>   static void time_type_print(const struct expr *expr)
>

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

      reply	other threads:[~2014-12-10 23:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-10 22:14 [PATCH] dtype: remove unnecessary icmp* parse/print functions Patrick McHardy
2014-12-10 23:48 ` Álvaro Neira Ayuso [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5488DBBA.40002@gmail.com \
    --to=alvaroneay@gmail.com \
    --cc=kaber@trash.net \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).