Re: [PATCH nft v2 2/2] datatype: Implement binary search in symbolic_constant_print()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
> ---
> 
>  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.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux