poke-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] pickles: pcap: fix PCAP_Packet body


From: Jose E. Marchesi
Subject: Re: [PATCH] pickles: pcap: fix PCAP_Packet body
Date: Sat, 07 Jan 2023 15:08:03 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

OK for master.
Thanks!

> 2022-01-07  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
>
>       * pickles/pcap.pk (PCAP_Packet): Declare body as a byte array.
> ---
>
> Hi Jose.
>
> The old code was wrong (my mistake), I suggest to use array syntax, despite
> the fact it'll slow down everything.
> I feels more idiomatic than `byte[0]'-technique.
> IMHO Poke is about describing (and poking!) data and should remain as
> declarative as possible.
>
> Maybe we can make PVM faster by somehow annotating big data fields.
> Like `lazy byte[len] data;` or ...
>
> WDYT?
>
> Regards,
> Mohammad-Reza
>
>
>  ChangeLog       |  4 ++++
>  pickles/pcap.pk | 13 +------------
>  2 files changed, 5 insertions(+), 12 deletions(-)
>
> diff --git a/ChangeLog b/ChangeLog
> index f9a5f58a..33cc53cb 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,7 @@
> +2022-01-07  Mohammad-Reza Nabipoor  <mnabipoor@gnu.org>
> +
> +     * pickles/pcap.pk (PCAP_Packet): Declare body as a byte array.
> +
>  2022-12-22  Darshit Shah  <darnir@gnu.org>
>  
>       * doc/poke.texi: Simplify Hyperlink setup by calling `make install`
> diff --git a/pickles/pcap.pk b/pickles/pcap.pk
> index 45b8cd22..f911f8e4 100644
> --- a/pickles/pcap.pk
> +++ b/pickles/pcap.pk
> @@ -66,18 +66,7 @@ type PCAP_Packet =
>    struct
>    {
>      PCAP_PacketHeader header;
> -
> -    var body_offset = OFFSET;
> -    var body_length = header.incl_len;
> -
> -    byte[0] @ body_offset + body_length; /* End-of-packet marker */
> -
> -    method get_body_offset = offset<uint32,B>: { return body_offset; }
> -    method get_body_length = offset<uint32,B>: { return body_length; }
> -    method get_body = byte[]:
> -      {
> -        return byte[body_length] @ body_offset;
> -      }
> +    byte[header.incl_len] body;
>    };
>  
>  type PCAP =



reply via email to

[Prev in Thread] Current Thread [Next in Thread]