From ceb4f43944deef50fdb004d9f8ac68ad5afd608c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Fri, 29 Sep 2023 18:39:49 +0200 Subject: [PATCH] pipewire: rtsp-client: use flexible array member for outgoing message content There is no need to have an extra pointer in the struct that is set to right after the object at initialization and is never modified because a flexible array member can be used instead. This has advantages: `struct message` is now smaller, and there is no extra load when accessing `struct message::data`. --- src/modules/module-raop/rtsp-client.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/modules/module-raop/rtsp-client.c b/src/modules/module-raop/rtsp-client.c index 7e4b061c1..952891d9a 100644 --- a/src/modules/module-raop/rtsp-client.c +++ b/src/modules/module-raop/rtsp-client.c @@ -21,12 +21,12 @@ struct message { struct spa_list link; - void *data; size_t len; size_t offset; uint32_t cseq; int (*reply) (void *user_data, int status, const struct spa_dict *headers, const struct pw_array *content); void *user_data; + unsigned char data[]; }; enum client_recv_state { @@ -598,7 +598,6 @@ int pw_rtsp_client_url_send(struct pw_rtsp_client *client, const char *url, fclose(f); - msg->data = SPA_PTROFF(msg, sizeof(*msg), void); msg->len = len - sizeof(*msg); msg->offset = 0; msg->reply = reply;