From 98c7d8b6488f03ca376c287b8e05529b0a58d394 Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Thu, 19 Jan 2023 03:47:49 +0200 Subject: [PATCH] fix warnings --- match.c | 6 +++--- match.h | 2 +- server.c | 9 +++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/match.c b/match.c index 7c03d9f..112c5ca 100644 --- a/match.c +++ b/match.c @@ -178,7 +178,7 @@ fail: } \ } while(0) -int match_check_sender(Bus *s, BusClient *sender_client, MatchRule *rule) +int match_check_sender(BusClient *sender_client, MatchRule *rule) { if (rule->sender) { if (sender_client->unique_name) { @@ -196,7 +196,7 @@ int match_check_sender(Bus *s, BusClient *sender_client, MatchRule *rule) return -1; } -int match_rule_check(Bus *s, BusClient *sender_client, MatchRule *rule, WireMsg *msg, WireCtx *ctx) +int match_rule_check(BusClient *sender_client, MatchRule *rule, WireMsg *msg, WireCtx *ctx) { if (rule->type && msg->type != rule->type) { return -1; @@ -208,7 +208,7 @@ int match_rule_check(Bus *s, BusClient *sender_client, MatchRule *rule, WireMsg return -1; } } else { - if (match_check_sender(s, sender_client, rule) < 0) { + if (match_check_sender(sender_client, rule) < 0) { return -1; } } diff --git a/match.h b/match.h index 75f4fc1..e36e1d3 100644 --- a/match.h +++ b/match.h @@ -8,6 +8,6 @@ void match_rule_free(MatchRule *rule); MatchRule *match_rule_from_string(char *d); -int match_rule_check(Bus *s, BusClient *sender_client, MatchRule *rule, WireMsg *msg, WireCtx *ctx); +int match_rule_check(BusClient *sender_client, MatchRule *rule, WireMsg *msg, WireCtx *ctx); #endif // _JITTERBUG__MATCH_H diff --git a/server.c b/server.c index 6e150a7..5bbfc75 100644 --- a/server.c +++ b/server.c @@ -196,7 +196,7 @@ BusName *bus_name_add(Bus *s, char *name, BusClient *client) return NULL; } -int bus_client_match_add(Bus *s, BusClient *c, char *match) +int bus_client_match_add(BusClient *c, char *match) { for (int i = 0; i < BUS_MAX_MATCH; i++) { if (!c->matches[i]) { @@ -325,7 +325,7 @@ int bus_broadcast_message(Bus *s, BusClient *sender_client, WireMsg *msg, WireCt match_left--; uint32_t previous_cursor = ctx->byte_cursor; - if (match_rule_check(s, sender_client, c->matches[j], msg, ctx) >= 0) { + if (match_rule_check(sender_client, c->matches[j], msg, ctx) >= 0) { TRYST(wire_compose_unicast_reply(reply_ctx, ctx, msg, sender_client->unique_name->name)); TRYST(send(c->fd, reply_ctx->data, reply_ctx->byte_cursor, 0)); // TODO? @@ -360,7 +360,7 @@ int bus_broadcast_signal(Bus *s, BusClient *client, WireCtx *ctx, WireMsg *msg) } match_left--; - if (match_rule_check(s, client, c->matches[j], msg, ctx) >= 0) { + if (match_rule_check(client, c->matches[j], msg, ctx) >= 0) { uint32_t previous_cursor = ctx->byte_cursor; TRYST(send(c->fd, ctx->data, ctx->byte_cursor, 0)); ctx->byte_cursor = previous_cursor; @@ -399,6 +399,7 @@ int bus_unicast_message(Bus *s, WireMsg *msg, WireCtx *ctx, char *target_name, c #define _reply_begin(M_sig) \ + (void)s; \ uint32_t *body_length = NULL; \ uint32_t body_start = 0; \ if (!(msg->flags & DBUS_FLAG_NO_REPLY_EXPECTED)) { \ @@ -569,7 +570,7 @@ int handle_add_match(Bus *s, BusClient *client, WireMsg *msg, WireCtx *ctx, Wire VERBOSE("client index %d adding match rule: '%s'\n", client->fd_index, match); - TRYST(bus_client_match_add(s, client, match)); + TRYST(bus_client_match_add(client, match)); _reply_begin("") {} _reply_end() return 0;