diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-11 10:44:54 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-06-11 10:44:54 +0200 |
commit | 63fed0e85b72e27049ce14c80127859b387460dd (patch) | |
tree | e0542ae194c04cb904f323042090f78fe8b886f5 /lib | |
parent | 91325080d96f721b290223420d224135cda40358 (diff) |
fix write_cmd_req_set_state
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pbdrv/pb-write.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/pbdrv/pb-write.c b/lib/pbdrv/pb-write.c index 752a4ac..294452e 100644 --- a/lib/pbdrv/pb-write.c +++ b/lib/pbdrv/pb-write.c @@ -7,10 +7,8 @@ typedef struct { pbdrv_buf_t buf; } pbdrv_writer_t; -static pbdrv_writer_t pbdrv_write_init() { - pbdrv_writer_t writer; - mpack_writer_init_growable(&writer.writer, &writer.buf.data, &writer.buf.size); - return writer; +static void pbdrv_write_init(pbdrv_writer_t * writer) { + mpack_writer_init_growable(&writer->writer, &writer->buf.data, &writer->buf.size); } static pbdrv_buf_t pbdrv_write_finish(pbdrv_writer_t * writer) { @@ -27,7 +25,8 @@ static void pbdrv_write_msg_header(pbdrv_writer_t * writer, pb_msg_header_t head } pbdrv_buf_t pbdrv_write_cmd_req_set_state(pb_cmd_req_set_state_t data) { - pbdrv_writer_t writer = pbdrv_write_init(); + pbdrv_writer_t writer; + pbdrv_write_init(&writer); pbdrv_write_msg_header(&writer, data.header); mpack_write_u8(&writer.writer, data.state); return pbdrv_write_finish(&writer); |