From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Elise Lennion <elise.lennion@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft v2 2/2] datatype: Implement binary search in symbolic_constant_print()
Date: Mon, 28 Nov 2016 09:50:49 +0100 [thread overview]
Message-ID: <20161128085049.GB949@salvia> (raw)
In-Reply-To: <20161128012814.GA22480@lennorien.com>
On Sun, Nov 27, 2016 at 11:28:14PM -0200, Elise Lennion wrote:
> Because a linear search is used, which is slower.
>
> This approach demands that the symbol_table have a variable with its
> size, also, it must be sorted by value.
>
> Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
> ---
>
> v2: This patch has no v1.
>
> include/datatype.h | 2 ++
> src/datatype.c | 37 +++++++++++++++++++++++++++++--------
> src/proto.c | 3 ++-
> src/services.c | 3 ++-
> 4 files changed, 35 insertions(+), 10 deletions(-)
>
> diff --git a/include/datatype.h b/include/datatype.h
> index e53797d..0e7db40 100644
> --- a/include/datatype.h
> +++ b/include/datatype.h
> @@ -178,10 +178,12 @@ struct symbolic_constant {
> /**
> * struct symbol_table - type construction from symbolic values
> *
> + * @size: number of symbols, without SYMBOL_LIST_END
> * @symbols: the symbols
> */
> struct symbol_table {
> int gcc_workaround;
You can know remove this gcc_workaround field.
> + unsigned int size;
> struct symbolic_constant symbols[];
> };
>
> diff --git a/src/datatype.c b/src/datatype.c
> index 1ae7db4..25d9000 100644
> --- a/src/datatype.c
> +++ b/src/datatype.c
> @@ -116,6 +116,18 @@ struct error_record *symbol_parse(const struct expr *sym,
> sym->dtype->desc);
> }
>
> +static int symbolic_constant_cmp(const void *p1, const void *p2)
> +{
> + const struct symbolic_constant f = *(struct symbolic_constant *)p1;
^^^^^^^^
I see spaces instead of tabs here. Same thing everywhere in this
patch.
prev parent reply other threads:[~2016-11-28 8:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-28 1:28 [PATCH nft v2 2/2] datatype: Implement binary search in symbolic_constant_print() Elise Lennion
2016-11-28 8:50 ` Pablo 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=20161128085049.GB949@salvia \
--to=pablo@netfilter.org \
--cc=elise.lennion@gmail.com \
--cc=netfilter-devel@vger.kernel.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