From 3c7fa5dd429b9ca82e4d890347f7685cdcaf5cf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?= Date: Mon, 25 Jun 2018 15:06:28 +0200 Subject: [PATCH] clock_send_notification: msg_len is unused MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit message length is already included in the msg structure Signed-off-by: Rafaël Carré --- clock.c | 6 ++---- clock.h | 3 +-- port.c | 4 +--- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/clock.c b/clock.c index 7bbb848..c0d73f0 100644 --- a/clock.c +++ b/clock.c @@ -232,7 +232,7 @@ static void clock_prune_subscriptions(struct clock *c) } void clock_send_notification(struct clock *c, struct ptp_message *msg, - int msglen, enum notification event) + enum notification event) { unsigned int event_pos = event / 8; uint8_t mask = 1 << (event % 8); @@ -1422,7 +1422,6 @@ void clock_notify_event(struct clock *c, enum notification event) struct port *uds = c->uds_port; struct PortIdentity pid = port_identity(uds); struct ptp_message *msg; - UInteger16 msg_len; int id; switch (event) { @@ -1437,10 +1436,9 @@ void clock_notify_event(struct clock *c, enum notification event) return; if (!clock_management_fill_response(c, NULL, NULL, msg, id)) goto err; - msg_len = msg->header.messageLength; if (msg_pre_send(msg)) goto err; - clock_send_notification(c, msg, msg_len, event); + clock_send_notification(c, msg, event); err: msg_put(msg); } diff --git a/clock.h b/clock.h index efde27f..cc2910a 100644 --- a/clock.h +++ b/clock.h @@ -191,11 +191,10 @@ int clock_manage(struct clock *c, struct port *p, struct ptp_message *msg); * Send notification about an event to all subscribers. * @param c The clock instance. * @param msg The PTP message to send, in network byte order. - * @param msglen The length of the message in bytes. * @param event The event that occured. */ void clock_send_notification(struct clock *c, struct ptp_message *msg, - int msglen, enum notification event); + enum notification event); /** * Construct and send notification to subscribers about an event that diff --git a/port.c b/port.c index 64c2fcf..86fca3b 100644 --- a/port.c +++ b/port.c @@ -2735,7 +2735,6 @@ void port_notify_event(struct port *p, enum notification event) { struct PortIdentity pid = port_identity(p); struct ptp_message *msg; - UInteger16 msg_len; int id; switch (event) { @@ -2752,10 +2751,9 @@ void port_notify_event(struct port *p, enum notification event) return; if (!port_management_fill_response(p, msg, id)) goto err; - msg_len = msg->header.messageLength; if (msg_pre_send(msg)) goto err; - clock_send_notification(p->clock, msg, msg_len, event); + clock_send_notification(p->clock, msg, event); err: msg_put(msg); }