From 67ee995cc1ec0a9ae2247dae6bdde54211be8c5a Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 9 Sep 2015 12:09:21 +0000 Subject: [PATCH 1/2] No need to keep global options around for client which doesn't use them. --- cfg.c | 2 +- client.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cfg.c b/cfg.c index ecb38fc0..2f457e6b 100644 --- a/cfg.c +++ b/cfg.c @@ -98,7 +98,7 @@ load_cfg(const char *path, struct cmd_q *cmdq, char **cause) } found = 0; - while ((buf = fparseln(f, NULL, &line, delim, 0))) { + while ((buf = fparseln(f, NULL, &line, delim, 0)) != NULL) { log_debug("%s: %s", path, buf); /* Skip empty lines. */ diff --git a/client.c b/client.c index 55c5aa56..d36be86b 100644 --- a/client.c +++ b/client.c @@ -268,6 +268,10 @@ client_main(struct event_base *base, int argc, char **argv, int flags) } return (1); } + options_free(&global_options); + options_free(&global_s_options); + options_free(&global_w_options); + environ_free(&global_environ); /* Create imsg. */ imsg_init(&client_ibuf, fd); From cfabe30becba6f0c54035a29ee61a6a7f3d0cf60 Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 10 Sep 2015 08:58:14 +0000 Subject: [PATCH 2/2] Add session_last_attached time and format, from Sina Siadat. --- cmd-attach-session.c | 2 ++ cmd-new-session.c | 1 + cmd-switch-client.c | 1 + format.c | 7 +++++++ server-fn.c | 1 + tmux.1 | 2 ++ tmux.h | 1 + 7 files changed, 15 insertions(+) diff --git a/cmd-attach-session.c b/cmd-attach-session.c index 356bd4aa..a2ae49cb 100644 --- a/cmd-attach-session.c +++ b/cmd-attach-session.c @@ -136,6 +136,7 @@ cmd_attach_session(struct cmd_q *cmdq, const char *tflag, int dflag, int rflag, status_timer_start(c); notify_attached_session_changed(c); session_update_activity(s, NULL); + gettimeofday(&s->last_attached_time, NULL); server_redraw_client(c); s->curw->flags &= ~WINLINK_ALERTFLAGS; } else { @@ -181,6 +182,7 @@ cmd_attach_session(struct cmd_q *cmdq, const char *tflag, int dflag, int rflag, status_timer_start(c); notify_attached_session_changed(c); session_update_activity(s, NULL); + gettimeofday(&s->last_attached_time, NULL); server_redraw_client(c); s->curw->flags &= ~WINLINK_ALERTFLAGS; diff --git a/cmd-new-session.c b/cmd-new-session.c index fa4f1553..7687398e 100644 --- a/cmd-new-session.c +++ b/cmd-new-session.c @@ -278,6 +278,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq) status_timer_start(c); notify_attached_session_changed(c); session_update_activity(s, NULL); + gettimeofday(&s->last_attached_time, NULL); server_redraw_client(c); } recalculate_sizes(); diff --git a/cmd-switch-client.c b/cmd-switch-client.c index 8bc8a3c5..10171018 100644 --- a/cmd-switch-client.c +++ b/cmd-switch-client.c @@ -129,6 +129,7 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_q *cmdq) c->session = s; status_timer_start(c); session_update_activity(s, NULL); + gettimeofday(&s->last_attached_time, NULL); recalculate_sizes(); server_check_unattached(); diff --git a/format.c b/format.c index 20cf0adb..c401fa35 100644 --- a/format.c +++ b/format.c @@ -872,6 +872,13 @@ format_defaults_session(struct format_tree *ft, struct session *s) format_add(ft, "session_created", "%lld", (long long) t); format_add(ft, "session_created_string", "%s", format_time_string(t)); + t = s->last_attached_time.tv_sec; + if (t != 0) { /* zero if never attached */ + format_add(ft, "session_last_attached", "%lld", (long long) t); + format_add(ft, "session_last_attached_string", "%s", + format_time_string(t)); + } + t = s->activity_time.tv_sec; format_add(ft, "session_activity", "%lld", (long long) t); format_add(ft, "session_activity_string", "%s", format_time_string(t)); diff --git a/server-fn.c b/server-fn.c index cddd762f..27908fde 100644 --- a/server-fn.c +++ b/server-fn.c @@ -422,6 +422,7 @@ server_destroy_session(struct session *s) status_timer_start(c); notify_attached_session_changed(c); session_update_activity(s_new, NULL); + gettimeofday(&s_new->last_attached_time, NULL); server_redraw_client(c); } } diff --git a/tmux.1 b/tmux.1 index 8e07fc2a..a2f6cb96 100644 --- a/tmux.1 +++ b/tmux.1 @@ -3401,6 +3401,8 @@ The following variables are available, where appropriate: .It Li "session_activity_string" Ta "" Ta "String time of session last activity" .It Li "session_created" Ta "" Ta "Integer time session created" .It Li "session_created_string" Ta "" Ta "String time session created" +.It Li "session_last_attached" Ta "" Ta "Integer time session last attached" +.It Li "session_last_attached_string" Ta "" Ta "String time session last attached" .It Li "session_group" Ta "" Ta "Number of session group" .It Li "session_grouped" Ta "" Ta "1 if session in a group" .It Li "session_height" Ta "" Ta "Height of session" diff --git a/tmux.h b/tmux.h index 0223d857..8cd83e27 100644 --- a/tmux.h +++ b/tmux.h @@ -981,6 +981,7 @@ struct session { int cwd; struct timeval creation_time; + struct timeval last_attached_time; struct timeval activity_time; struct timeval last_activity_time;