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`.
This commit is contained in:
Barnabás Pőcze 2023-09-29 18:39:49 +02:00 committed by Wim Taymans
parent 37b2633756
commit ceb4f43944

View file

@ -21,12 +21,12 @@
struct message { struct message {
struct spa_list link; struct spa_list link;
void *data;
size_t len; size_t len;
size_t offset; size_t offset;
uint32_t cseq; uint32_t cseq;
int (*reply) (void *user_data, int status, const struct spa_dict *headers, const struct pw_array *content); int (*reply) (void *user_data, int status, const struct spa_dict *headers, const struct pw_array *content);
void *user_data; void *user_data;
unsigned char data[];
}; };
enum client_recv_state { enum client_recv_state {
@ -598,7 +598,6 @@ int pw_rtsp_client_url_send(struct pw_rtsp_client *client, const char *url,
fclose(f); fclose(f);
msg->data = SPA_PTROFF(msg, sizeof(*msg), void);
msg->len = len - sizeof(*msg); msg->len = len - sizeof(*msg);
msg->offset = 0; msg->offset = 0;
msg->reply = reply; msg->reply = reply;