Siva Mahadevan
unread,Jan 31, 2022, 2:09:08 AM1/31/22Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to tmux-...@googlegroups.com, Siva Mahadevan
Fix the warning in the condition `(wp != NULL ? wp->id : -1)` where `id`
is a u_int but -1 is an int.
---
control-notify.c | 7 +++++--
notify.c | 6 +++---
tmux.h | 2 +-
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/control-notify.c b/control-notify.c
index 6ff0e436..865c8f80 100644
--- a/control-notify.c
+++ b/control-notify.c
@@ -27,15 +27,18 @@
((c) != NULL && ((c)->flags & CLIENT_CONTROL))
void
-control_notify_pane_mode_changed(int pane)
+control_notify_pane_mode_changed(struct window_pane *pane)
{
struct client *c;
+ if (pane == NULL)
+ return;
+
TAILQ_FOREACH(c, &clients, entry) {
if (!CONTROL_SHOULD_NOTIFY_CLIENT(c))
continue;
- control_write(c, "%%pane-mode-changed %%%u", pane);
+ control_write(c, "%%pane-mode-changed %%%u", pane->id);
}
}
diff --git a/notify.c b/notify.c
index 9c55d0b8..d45e4c73 100644
--- a/notify.c
+++ b/notify.c
@@ -31,7 +31,7 @@ struct notify_entry {
struct client *client;
struct session *session;
struct window *window;
- int pane;
+ struct window_pane *pane;
};
static void
@@ -153,7 +153,7 @@ notify_add(const char *name, struct cmd_find_state *fs, struct client *c,
ne->client = c;
ne->session = s;
ne->window = w;
- ne->pane = (wp != NULL ? wp->id : -1);
+ ne->pane = wp;
ne->formats = format_create(NULL, NULL, 0, FORMAT_NOJOBS);
format_add(ne->formats, "hook", "%s", name);
@@ -199,7 +199,7 @@ notify_hook(struct cmdq_item *item, const char *name)
ne.client = cmdq_get_client(item);
ne.session = target->s;
ne.window = target->w;
- ne.pane = (target->wp != NULL ? target->wp->id : -1);
+ ne.pane = target->wp;
ne.formats = format_create(NULL, NULL, 0, FORMAT_NOJOBS);
format_add(ne.formats, "hook", "%s", name);
diff --git a/tmux.h b/tmux.h
index 8a6dec18..3cbcc24f 100644
--- a/tmux.h
+++ b/tmux.h
@@ -3042,7 +3042,7 @@ void control_remove_sub(struct client *, const char *);
/* control-notify.c */
void control_notify_input(struct client *, struct window_pane *,
const u_char *, size_t);
-void control_notify_pane_mode_changed(int);
+void control_notify_pane_mode_changed(struct window_pane *);
void control_notify_window_layout_changed(struct window *);
void control_notify_window_pane_changed(struct window *);
void control_notify_window_unlinked(struct session *, struct window *);
--
2.35.1