diff mbox series

[4/9] fifo8: replace fifo8_pop_bufptr() with fifo8_peekpop_bufptr() in fifo8_pop_buf()

Message ID 20240828122258.928947-5-mark.cave-ayland@ilande.co.uk
State New
Headers show
Series fifo8: add fifo8_peek(), fifo8_peek_buf() and tests | expand

Commit Message

Mark Cave-Ayland Aug. 28, 2024, 12:22 p.m. UTC
The upcoming peek functionality will require passing a non-zero value to
fifo8_peekpop_bufptr().

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 util/fifo8.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Alistair Francis Aug. 29, 2024, 11:52 p.m. UTC | #1
On Wed, Aug 28, 2024 at 10:25 PM Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> The upcoming peek functionality will require passing a non-zero value to
> fifo8_peekpop_bufptr().
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  util/fifo8.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/util/fifo8.c b/util/fifo8.c
> index 62d6430b05..efe0117b1f 100644
> --- a/util/fifo8.c
> +++ b/util/fifo8.c
> @@ -116,7 +116,7 @@ uint32_t fifo8_pop_buf(Fifo8 *fifo, uint8_t *dest, uint32_t destlen)
>      }
>
>      len = destlen;
> -    buf = fifo8_pop_bufptr(fifo, len, &n1);
> +    buf = fifo8_peekpop_bufptr(fifo, len, 0, &n1, true);
>      if (dest) {
>          memcpy(dest, buf, n1);
>      }
> @@ -125,7 +125,7 @@ uint32_t fifo8_pop_buf(Fifo8 *fifo, uint8_t *dest, uint32_t destlen)
>      len -= n1;
>      len = MIN(len, fifo8_num_used(fifo));
>      if (len) {
> -        buf = fifo8_pop_bufptr(fifo, len, &n2);
> +        buf = fifo8_peekpop_bufptr(fifo, len, 0, &n2, true);
>          if (dest) {
>              memcpy(&dest[n1], buf, n2);
>          }
> --
> 2.39.2
>
>
Octavian Purdila Aug. 31, 2024, 12:15 a.m. UTC | #2
On Wed, Aug 28, 2024 at 5:23 AM Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> The upcoming peek functionality will require passing a non-zero value to
> fifo8_peekpop_bufptr().
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

Reviewed-by: Octavian Purdila <tavip@google.com>

> ---
>  util/fifo8.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/util/fifo8.c b/util/fifo8.c
> index 62d6430b05..efe0117b1f 100644
> --- a/util/fifo8.c
> +++ b/util/fifo8.c
> @@ -116,7 +116,7 @@ uint32_t fifo8_pop_buf(Fifo8 *fifo, uint8_t *dest, uint32_t destlen)
>      }
>
>      len = destlen;
> -    buf = fifo8_pop_bufptr(fifo, len, &n1);
> +    buf = fifo8_peekpop_bufptr(fifo, len, 0, &n1, true);
>      if (dest) {
>          memcpy(dest, buf, n1);
>      }
> @@ -125,7 +125,7 @@ uint32_t fifo8_pop_buf(Fifo8 *fifo, uint8_t *dest, uint32_t destlen)
>      len -= n1;
>      len = MIN(len, fifo8_num_used(fifo));
>      if (len) {
> -        buf = fifo8_pop_bufptr(fifo, len, &n2);
> +        buf = fifo8_peekpop_bufptr(fifo, len, 0, &n2, true);
>          if (dest) {
>              memcpy(&dest[n1], buf, n2);
>          }
> --
> 2.39.2
>
diff mbox series

Patch

diff --git a/util/fifo8.c b/util/fifo8.c
index 62d6430b05..efe0117b1f 100644
--- a/util/fifo8.c
+++ b/util/fifo8.c
@@ -116,7 +116,7 @@  uint32_t fifo8_pop_buf(Fifo8 *fifo, uint8_t *dest, uint32_t destlen)
     }
 
     len = destlen;
-    buf = fifo8_pop_bufptr(fifo, len, &n1);
+    buf = fifo8_peekpop_bufptr(fifo, len, 0, &n1, true);
     if (dest) {
         memcpy(dest, buf, n1);
     }
@@ -125,7 +125,7 @@  uint32_t fifo8_pop_buf(Fifo8 *fifo, uint8_t *dest, uint32_t destlen)
     len -= n1;
     len = MIN(len, fifo8_num_used(fifo));
     if (len) {
-        buf = fifo8_pop_bufptr(fifo, len, &n2);
+        buf = fifo8_peekpop_bufptr(fifo, len, 0, &n2, true);
         if (dest) {
             memcpy(&dest[n1], buf, n2);
         }