circ_buf: fix -Wpointer-arith

Pointer arithmetic should not be done on void pointers.

  circ_buf.c: In function ‘circ_read’:
  circ_buf.c:104:25: warning: pointer of type ‘void *’ used in subtraction [-Wpointer-arith]
    104 |         return (void*)p - buf;
        |                         ^

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
This commit is contained in:
Krzysztof Kozlowski
2023-05-07 11:49:02 +02:00
committed by Bjorn Andersson
parent c6d97d34c3
commit 352dc1abca

View File

@@ -85,7 +85,7 @@ size_t circ_peak(struct circ_buf *circ, void *buf, size_t len)
tail = (tail + 1) & (CIRC_BUF_SIZE - 1);
}
return (void*)p - buf;
return p - (char *)buf;
}
size_t circ_read(struct circ_buf *circ, void *buf, size_t len)
@@ -101,5 +101,5 @@ size_t circ_read(struct circ_buf *circ, void *buf, size_t len)
circ->tail = (circ->tail + 1) & (CIRC_BUF_SIZE - 1);
}
return (void*)p - buf;
return p - (char *)buf;
}