mirror of
https://gitlab.freedesktop.org/plymouth/plymouth.git
synced 2026-05-08 14:48:01 +02:00
ply-buffer: Fix unused-value warning
We currently get warnings during the build like ``` ../src/libply/ply-buffer.h:60:20: warning: value computed is not used [-Wunused-value] 60 | !_ran && (*bytes = (char *) ply_buffer_get_bytes(buffer), | ^~ ``` This commit changes the macro to use a GCC statement expression with an if statement to work around the warning. Closes: https://gitlab.freedesktop.org/plymouth/plymouth/-/issues/246
This commit is contained in:
parent
18691572ee
commit
c65d37e4ac
1 changed files with 8 additions and 4 deletions
|
|
@ -57,10 +57,14 @@ size_t ply_buffer_get_capacity (ply_buffer_t *buffer);
|
|||
char *ply_buffer_steal_bytes (ply_buffer_t *buffer);
|
||||
#define ply_buffer_borrow_bytes(buffer, bytes, size, capacity) \
|
||||
for (bool _ran = false; \
|
||||
!_ran && (*bytes = (char *) ply_buffer_get_bytes (buffer), \
|
||||
*size = ply_buffer_get_size (buffer), \
|
||||
*capacity = ply_buffer_get_capacity (buffer)), \
|
||||
!_ran; \
|
||||
({ \
|
||||
if (!_ran) { \
|
||||
*bytes = (char *) ply_buffer_get_bytes (buffer); \
|
||||
*size = ply_buffer_get_size (buffer); \
|
||||
*capacity = ply_buffer_get_capacity (buffer); \
|
||||
} \
|
||||
!_ran; \
|
||||
}); \
|
||||
ply_buffer_set_bytes (buffer, *bytes, *size, *capacity), \
|
||||
_ran = true, \
|
||||
*bytes = NULL, \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue