From 5a5b950e8b86606edea8f61c40bf8af28ab4f08b Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 18 Nov 2015 14:13:55 +0000 Subject: [PATCH 1/2] Add s/foo/bar/: prefix for formats to substitute bar for foo. --- format.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++---------- tmux.1 | 7 +++++ 2 files changed, 73 insertions(+), 14 deletions(-) diff --git a/format.c b/format.c index 04e06fc6..e8d5dd09 100644 --- a/format.c +++ b/format.c @@ -99,6 +99,7 @@ format_job_cmp(struct format_job *fj1, struct format_job *fj2) #define FORMAT_TIMESTRING 0x1 #define FORMAT_BASENAME 0x2 #define FORMAT_DIRNAME 0x4 +#define FORMAT_SUBSTITUTE 0x8 /* Entry in format tree. */ struct format_entry { @@ -682,8 +683,9 @@ int format_replace(struct format_tree *ft, const char *key, size_t keylen, char **buf, size_t *len, size_t *off) { - char *copy, *copy0, *endptr, *ptr, *saved, *trimmed, *value; - size_t valuelen; + char *copy, *copy0, *endptr, *ptr, *found, *new, *value; + char *from = NULL, *to = NULL; + size_t valuelen, newlen, fromlen, tolen, used; u_long limit = 0; int modifiers = 0, brackets; @@ -721,6 +723,29 @@ format_replace(struct format_tree *ft, const char *key, size_t keylen, modifiers |= FORMAT_TIMESTRING; copy += 2; break; + case 's': + if (copy[1] != '/') + break; + from = copy + 2; + for (copy = from; *copy != '\0' && *copy != '/'; copy++) + /* nothing */; + if (copy[0] != '/' || copy == from) { + copy = copy0; + break; + } + copy[0] = '\0'; + to = copy + 1; + for (copy = to; *copy != '\0' && *copy != '/'; copy++) + /* nothing */; + if (copy[0] != '/' || copy[1] != ':') { + copy = copy0; + break; + } + copy[0] = '\0'; + + modifiers |= FORMAT_SUBSTITUTE; + copy += 2; + break; } /* @@ -734,7 +759,7 @@ format_replace(struct format_tree *ft, const char *key, size_t keylen, *ptr = '\0'; value = ptr + 1; - saved = format_find(ft, copy + 1, modifiers); + found = format_find(ft, copy + 1, modifiers); brackets = 0; for (ptr = ptr + 1; *ptr != '\0'; ptr++) { @@ -748,29 +773,56 @@ format_replace(struct format_tree *ft, const char *key, size_t keylen, if (*ptr == '\0') goto fail; - if (saved != NULL && *saved != '\0' && - (saved[0] != '0' || saved[1] != '\0')) { + if (found != NULL && *found != '\0' && + (found[0] != '0' || found[1] != '\0')) { *ptr = '\0'; } else value = ptr + 1; value = format_expand(ft, value); - free(saved); - saved = value; + free(found); } else { - saved = value = format_find(ft, copy, modifiers); + value = format_find(ft, copy, modifiers); if (value == NULL) - saved = value = xstrdup(""); + value = xstrdup(""); + } + + /* Perform substitution if any. */ + if (modifiers & FORMAT_SUBSTITUTE) { + fromlen = strlen(from); + tolen = strlen(to); + + newlen = strlen(value) + 1; + copy = new = xmalloc(newlen); + for (ptr = value; *ptr != '\0'; /* nothing */) { + if (strncmp(ptr, from, fromlen) != 0) { + *new++ = *ptr++; + continue; + } + used = new - copy; + + newlen += tolen; + copy = xrealloc(copy, newlen); + + new = copy + used; + memcpy(new, to, tolen); + + new += tolen; + ptr += fromlen; + } + *new = '\0'; + free(value); + value = copy; } /* Truncate the value if needed. */ if (limit != 0) { - value = trimmed = utf8_trimcstr(value, limit); - free(saved); - saved = trimmed; + new = utf8_trimcstr(value, limit); + free(value); + value = new; } - valuelen = strlen(value); /* Expand the buffer and copy in the value. */ + valuelen = strlen(value); while (*len - *off < valuelen + 1) { *buf = xreallocarray(*buf, 2, *len); *len *= 2; @@ -778,7 +830,7 @@ format_replace(struct format_tree *ft, const char *key, size_t keylen, memcpy(*buf + *off, value, valuelen); *off += valuelen; - free(saved); + free(value); free(copy0); return (0); diff --git a/tmux.1 b/tmux.1 index 3a08c8cd..a22bb3f3 100644 --- a/tmux.1 +++ b/tmux.1 @@ -3311,6 +3311,13 @@ prefixes are and .Xr dirname 3 of the variable respectively. +A prefix of the form +.Ql s/foo/bar/: +will substitute +.Ql foo +with +.Ql bar +throughout. .Pp In addition, the first line of a shell command's output may be inserted using .Ql #() . From 577c0e3e5a79e9f1f860487bc3f411d26758f026 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 18 Nov 2015 14:27:44 +0000 Subject: [PATCH 2/2] Use __unused rather than rolling our own. --- alerts.c | 4 ++-- cfg.c | 2 +- client.c | 5 +++-- cmd-kill-server.c | 2 +- cmd-list-buffers.c | 2 +- cmd-list-keys.c | 6 +++--- cmd-lock-server.c | 2 +- cmd-pipe-pane.c | 4 ++-- cmd-set-option.c | 14 +++++++------- cmd-wait-for.c | 4 ++-- control-notify.c | 8 ++++---- control.c | 2 +- format.c | 8 ++++---- job.c | 5 +++-- log.c | 2 +- names.c | 2 +- proc.c | 4 ++-- screen-write.c | 2 +- server-client.c | 8 ++++---- server-fn.c | 2 +- server.c | 2 +- session.c | 4 ++-- status.c | 4 ++-- tmux.h | 3 --- tty-keys.c | 2 +- tty.c | 8 ++++---- window-choose.c | 4 ++-- window-clock.c | 8 ++++---- window-copy.c | 6 +++--- window.c | 8 ++++---- 30 files changed, 68 insertions(+), 69 deletions(-) diff --git a/alerts.c b/alerts.c index f1477030..32e0d496 100644 --- a/alerts.c +++ b/alerts.c @@ -35,7 +35,7 @@ int alerts_check_silence(struct session *, struct winlink *); void alerts_ring_bell(struct session *); void -alerts_timer(unused int fd, unused short events, void *arg) +alerts_timer(__unused int fd, __unused short events, void *arg) { struct window *w = arg; @@ -45,7 +45,7 @@ alerts_timer(unused int fd, unused short events, void *arg) } void -alerts_callback(unused int fd, unused short events, unused void *arg) +alerts_callback(__unused int fd, __unused short events, __unused void *arg) { struct window *w; struct session *s; diff --git a/cfg.c b/cfg.c index 2f457e6b..136c94d1 100644 --- a/cfg.c +++ b/cfg.c @@ -133,7 +133,7 @@ load_cfg(const char *path, struct cmd_q *cmdq, char **cause) } void -cfg_default_done(unused struct cmd_q *cmdq) +cfg_default_done(__unused struct cmd_q *cmdq) { if (--cfg_references != 0) return; diff --git a/client.c b/client.c index bc934d33..53a98a30 100644 --- a/client.c +++ b/client.c @@ -410,7 +410,8 @@ client_send_identify(const char *ttynam, const char *cwd) /* Callback for client stdin read events. */ void -client_stdin_callback(unused int fd, unused short events, unused void *arg) +client_stdin_callback(__unused int fd, __unused short events, + __unused void *arg) { struct msg_stdin_data data; @@ -512,7 +513,7 @@ client_signal(int sig) /* Callback for client read events. */ void -client_dispatch(struct imsg *imsg, unused void *arg) +client_dispatch(struct imsg *imsg, __unused void *arg) { if (imsg == NULL) { client_exitreason = CLIENT_EXIT_LOST_SERVER; diff --git a/cmd-kill-server.c b/cmd-kill-server.c index 07d94302..4107e6b6 100644 --- a/cmd-kill-server.c +++ b/cmd-kill-server.c @@ -46,7 +46,7 @@ const struct cmd_entry cmd_start_server_entry = { }; enum cmd_retval -cmd_kill_server_exec(struct cmd *self, unused struct cmd_q *cmdq) +cmd_kill_server_exec(struct cmd *self, __unused struct cmd_q *cmdq) { if (self->entry == &cmd_kill_server_entry) kill(getpid(), SIGTERM); diff --git a/cmd-list-buffers.c b/cmd-list-buffers.c index 3a8a790a..a0036032 100644 --- a/cmd-list-buffers.c +++ b/cmd-list-buffers.c @@ -41,7 +41,7 @@ const struct cmd_entry cmd_list_buffers_entry = { }; enum cmd_retval -cmd_list_buffers_exec(unused struct cmd *self, struct cmd_q *cmdq) +cmd_list_buffers_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; struct paste_buffer *pb; diff --git a/cmd-list-keys.c b/cmd-list-keys.c index 3b6afa3e..4355f24e 100644 --- a/cmd-list-keys.c +++ b/cmd-list-keys.c @@ -30,7 +30,7 @@ enum cmd_retval cmd_list_keys_exec(struct cmd *, struct cmd_q *); enum cmd_retval cmd_list_keys_table(struct cmd *, struct cmd_q *); -enum cmd_retval cmd_list_keys_commands(struct cmd *, struct cmd_q *); +enum cmd_retval cmd_list_keys_commands(struct cmd_q *); const struct cmd_entry cmd_list_keys_entry = { "list-keys", "lsk", @@ -60,7 +60,7 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_q *cmdq) int repeat, width, tablewidth, keywidth; if (self->entry == &cmd_list_commands_entry) - return (cmd_list_keys_commands(self, cmdq)); + return (cmd_list_keys_commands(cmdq)); if (args_has(args, 't')) return (cmd_list_keys_table(self, cmdq)); @@ -178,7 +178,7 @@ cmd_list_keys_table(struct cmd *self, struct cmd_q *cmdq) } enum cmd_retval -cmd_list_keys_commands(unused struct cmd *self, struct cmd_q *cmdq) +cmd_list_keys_commands(struct cmd_q *cmdq) { const struct cmd_entry **entryp; const struct cmd_entry *entry; diff --git a/cmd-lock-server.c b/cmd-lock-server.c index de76475d..a0204129 100644 --- a/cmd-lock-server.c +++ b/cmd-lock-server.c @@ -51,7 +51,7 @@ const struct cmd_entry cmd_lock_client_entry = { }; enum cmd_retval -cmd_lock_server_exec(struct cmd *self, unused struct cmd_q *cmdq) +cmd_lock_server_exec(struct cmd *self, __unused struct cmd_q *cmdq) { struct args *args = self->args; struct client *c; diff --git a/cmd-pipe-pane.c b/cmd-pipe-pane.c index df706432..87c802b9 100644 --- a/cmd-pipe-pane.c +++ b/cmd-pipe-pane.c @@ -142,8 +142,8 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmd_q *cmdq) } void -cmd_pipe_pane_error_callback( - unused struct bufferevent *bufev, unused short what, void *data) +cmd_pipe_pane_error_callback(__unused struct bufferevent *bufev, + __unused short what, void *data) { struct window_pane *wp = data; diff --git a/cmd-set-option.c b/cmd-set-option.c index c5a77b45..894f0c43 100644 --- a/cmd-set-option.c +++ b/cmd-set-option.c @@ -350,7 +350,7 @@ cmd_set_option_set(struct cmd *self, struct cmd_q *cmdq, /* Set a string option. */ struct options_entry * -cmd_set_option_string(struct cmd *self, unused struct cmd_q *cmdq, +cmd_set_option_string(struct cmd *self, __unused struct cmd_q *cmdq, const struct options_table_entry *oe, struct options *oo, const char *value) { @@ -372,7 +372,7 @@ cmd_set_option_string(struct cmd *self, unused struct cmd_q *cmdq, /* Set a number option. */ struct options_entry * -cmd_set_option_number(unused struct cmd *self, struct cmd_q *cmdq, +cmd_set_option_number(__unused struct cmd *self, struct cmd_q *cmdq, const struct options_table_entry *oe, struct options *oo, const char *value) { @@ -390,7 +390,7 @@ cmd_set_option_number(unused struct cmd *self, struct cmd_q *cmdq, /* Set a key option. */ struct options_entry * -cmd_set_option_key(unused struct cmd *self, struct cmd_q *cmdq, +cmd_set_option_key(__unused struct cmd *self, struct cmd_q *cmdq, const struct options_table_entry *oe, struct options *oo, const char *value) { @@ -406,7 +406,7 @@ cmd_set_option_key(unused struct cmd *self, struct cmd_q *cmdq, /* Set a colour option. */ struct options_entry * -cmd_set_option_colour(unused struct cmd *self, struct cmd_q *cmdq, +cmd_set_option_colour(__unused struct cmd *self, struct cmd_q *cmdq, const struct options_table_entry *oe, struct options *oo, const char *value) { @@ -422,7 +422,7 @@ cmd_set_option_colour(unused struct cmd *self, struct cmd_q *cmdq, /* Set an attributes option. */ struct options_entry * -cmd_set_option_attributes(unused struct cmd *self, struct cmd_q *cmdq, +cmd_set_option_attributes(__unused struct cmd *self, struct cmd_q *cmdq, const struct options_table_entry *oe, struct options *oo, const char *value) { @@ -438,7 +438,7 @@ cmd_set_option_attributes(unused struct cmd *self, struct cmd_q *cmdq, /* Set a flag option. */ struct options_entry * -cmd_set_option_flag(unused struct cmd *self, struct cmd_q *cmdq, +cmd_set_option_flag(__unused struct cmd *self, struct cmd_q *cmdq, const struct options_table_entry *oe, struct options *oo, const char *value) { @@ -466,7 +466,7 @@ cmd_set_option_flag(unused struct cmd *self, struct cmd_q *cmdq, /* Set a choice option. */ struct options_entry * -cmd_set_option_choice(unused struct cmd *self, struct cmd_q *cmdq, +cmd_set_option_choice(__unused struct cmd *self, struct cmd_q *cmdq, const struct options_table_entry *oe, struct options *oo, const char *value) { diff --git a/cmd-wait-for.c b/cmd-wait-for.c index 79e0b55e..04316d5e 100644 --- a/cmd-wait-for.c +++ b/cmd-wait-for.c @@ -111,7 +111,7 @@ cmd_wait_for_remove(struct wait_channel *wc) } enum cmd_retval -cmd_wait_for_exec(struct cmd *self, unused struct cmd_q *cmdq) +cmd_wait_for_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; const char *name = args->argv[0]; @@ -130,7 +130,7 @@ cmd_wait_for_exec(struct cmd *self, unused struct cmd_q *cmdq) } enum cmd_retval -cmd_wait_for_signal(unused struct cmd_q *cmdq, const char *name, +cmd_wait_for_signal(__unused struct cmd_q *cmdq, const char *name, struct wait_channel *wc) { struct cmd_q *wq, *wq1; diff --git a/control-notify.c b/control-notify.c index 16a98e3a..db3648a4 100644 --- a/control-notify.c +++ b/control-notify.c @@ -101,7 +101,7 @@ control_notify_window_layout_changed(struct window *w) } void -control_notify_window_unlinked(unused struct session *s, struct window *w) +control_notify_window_unlinked(__unused struct session *s, struct window *w) { struct client *c; struct session *cs; @@ -119,7 +119,7 @@ control_notify_window_unlinked(unused struct session *s, struct window *w) } void -control_notify_window_linked(unused struct session *s, struct window *w) +control_notify_window_linked(__unused struct session *s, struct window *w) { struct client *c; struct session *cs; @@ -183,7 +183,7 @@ control_notify_session_renamed(struct session *s) } void -control_notify_session_created(unused struct session *s) +control_notify_session_created(__unused struct session *s) { struct client *c; @@ -196,7 +196,7 @@ control_notify_session_created(unused struct session *s) } void -control_notify_session_close(unused struct session *s) +control_notify_session_close(__unused struct session *s) { struct client *c; diff --git a/control.c b/control.c index f7264944..e799a4cb 100644 --- a/control.c +++ b/control.c @@ -51,7 +51,7 @@ control_write_buffer(struct client *c, struct evbuffer *buffer) /* Control input callback. Read lines and fire commands. */ void -control_callback(struct client *c, int closed, unused void *data) +control_callback(struct client *c, int closed, __unused void *data) { char *line, *cause; struct cmd_list *cmdlist; diff --git a/format.c b/format.c index e8d5dd09..50fa7dea 100644 --- a/format.c +++ b/format.c @@ -259,7 +259,7 @@ format_job_get(struct format_tree *ft, const char *cmd) /* Remove old jobs. */ void -format_job_timer(unused int fd, unused short events, unused void *arg) +format_job_timer(__unused int fd, __unused short events, __unused void *arg) { struct format_job *fj, *fj1; time_t now; @@ -288,7 +288,7 @@ format_job_timer(unused int fd, unused short events, unused void *arg) /* Callback for host. */ void -format_cb_host(unused struct format_tree *ft, struct format_entry *fe) +format_cb_host(__unused struct format_tree *ft, struct format_entry *fe) { char host[HOST_NAME_MAX + 1]; @@ -300,7 +300,7 @@ format_cb_host(unused struct format_tree *ft, struct format_entry *fe) /* Callback for host_short. */ void -format_cb_host_short(unused struct format_tree *ft, struct format_entry *fe) +format_cb_host_short(__unused struct format_tree *ft, struct format_entry *fe) { char host[HOST_NAME_MAX + 1], *cp; @@ -315,7 +315,7 @@ format_cb_host_short(unused struct format_tree *ft, struct format_entry *fe) /* Callback for pid. */ void -format_cb_pid(unused struct format_tree *ft, struct format_entry *fe) +format_cb_pid(__unused struct format_tree *ft, struct format_entry *fe) { xasprintf(&fe->value, "%ld", (long)getpid()); } diff --git a/job.c b/job.c index 0aee7b05..e9799956 100644 --- a/job.c +++ b/job.c @@ -150,7 +150,7 @@ job_free(struct job *job) /* Called when output buffer falls below low watermark (default is 0). */ void -job_write_callback(unused struct bufferevent *bufev, void *data) +job_write_callback(__unused struct bufferevent *bufev, void *data) { struct job *job = data; size_t len = EVBUFFER_LENGTH(EVBUFFER_OUTPUT(job->event)); @@ -166,7 +166,8 @@ job_write_callback(unused struct bufferevent *bufev, void *data) /* Job buffer error callback. */ void -job_callback(unused struct bufferevent *bufev, unused short events, void *data) +job_callback(__unused struct bufferevent *bufev, __unused short events, + void *data) { struct job *job = data; diff --git a/log.c b/log.c index cf65c9e3..6c7be8b2 100644 --- a/log.c +++ b/log.c @@ -33,7 +33,7 @@ void log_vwrite(const char *, va_list); /* Log callback for libevent. */ void -log_event_cb(unused int severity, const char *msg) +log_event_cb(__unused int severity, const char *msg) { log_debug("%s", msg); } diff --git a/names.c b/names.c index 0e806ca0..7d956db3 100644 --- a/names.c +++ b/names.c @@ -29,7 +29,7 @@ void name_time_callback(int, short, void *); int name_time_expired(struct window *, struct timeval *); void -name_time_callback(unused int fd, unused short events, void *arg) +name_time_callback(__unused int fd, __unused short events, void *arg) { struct window *w = arg; diff --git a/proc.c b/proc.c index 6b84fc00..31fd136b 100644 --- a/proc.c +++ b/proc.c @@ -53,7 +53,7 @@ static int peer_check_version(struct tmuxpeer *, struct imsg *); static void proc_update_event(struct tmuxpeer *); static void -proc_event_cb(unused int fd, short events, void *arg) +proc_event_cb(__unused int fd, short events, void *arg) { struct tmuxpeer *peer = arg; ssize_t n; @@ -101,7 +101,7 @@ proc_event_cb(unused int fd, short events, void *arg) } static void -proc_signal_cb(int signo, unused short events, void *arg) +proc_signal_cb(int signo, __unused short events, void *arg) { struct tmuxproc *tp = arg; diff --git a/screen-write.c b/screen-write.c index a887b0f1..53067efe 100644 --- a/screen-write.c +++ b/screen-write.c @@ -42,7 +42,7 @@ screen_write_start(struct screen_write_ctx *ctx, struct window_pane *wp, /* Finish writing. */ void -screen_write_stop(unused struct screen_write_ctx *ctx) +screen_write_stop(__unused struct screen_write_ctx *ctx) { } diff --git a/server-client.c b/server-client.c index 645492d1..04929dec 100644 --- a/server-client.c +++ b/server-client.c @@ -246,7 +246,7 @@ server_client_unref(struct client *c) /* Free dead client. */ void -server_client_free(unused int fd, unused short events, void *arg) +server_client_free(__unused int fd, __unused short events, void *arg) { struct client *c = arg; @@ -818,7 +818,7 @@ server_client_reset_state(struct client *c) /* Repeat time callback. */ void -server_client_repeat_timer(unused int fd, unused short events, void *data) +server_client_repeat_timer(__unused int fd, __unused short events, void *data) { struct client *c = data; @@ -1214,7 +1214,7 @@ server_client_dispatch_shell(struct client *c) /* Event callback to push more stdout data if any left. */ static void -server_client_stdout_cb(unused int fd, unused short events, void *arg) +server_client_stdout_cb(__unused int fd, __unused short events, void *arg) { struct client *c = arg; @@ -1255,7 +1255,7 @@ server_client_push_stdout(struct client *c) /* Event callback to push more stderr data if any left. */ static void -server_client_stderr_cb(unused int fd, unused short events, void *arg) +server_client_stderr_cb(__unused int fd, __unused short events, void *arg) { struct client *c = arg; diff --git a/server-fn.c b/server-fn.c index bded7246..3e4b6116 100644 --- a/server-fn.c +++ b/server-fn.c @@ -443,7 +443,7 @@ server_clear_identify(struct client *c) } void -server_callback_identify(unused int fd, unused short events, void *data) +server_callback_identify(__unused int fd, __unused short events, void *data) { struct client *c = data; diff --git a/server.c b/server.c index 2808c0cc..55a53a40 100644 --- a/server.c +++ b/server.c @@ -298,7 +298,7 @@ server_update_socket(void) /* Callback for server socket. */ void -server_accept(int fd, short events, unused void *data) +server_accept(int fd, short events, __unused void *data) { struct sockaddr_storage sa; socklen_t slen = sizeof sa; diff --git a/session.c b/session.c index deb29d18..c5721c9a 100644 --- a/session.c +++ b/session.c @@ -181,7 +181,7 @@ session_unref(struct session *s) /* Free session. */ void -session_free(unused int fd, unused short events, void *arg) +session_free(__unused int fd, __unused short events, void *arg) { struct session *s = arg; @@ -236,7 +236,7 @@ session_check_name(const char *name) /* Lock session if it has timed out. */ void -session_lock_timer(unused int fd, unused short events, void *arg) +session_lock_timer(__unused int fd, __unused short events, void *arg) { struct session *s = arg; diff --git a/status.c b/status.c index 326e5ad8..e09ac592 100644 --- a/status.c +++ b/status.c @@ -145,7 +145,7 @@ status_prompt_save_history(void) /* Status timer callback. */ void -status_timer_callback(unused int fd, unused short events, void *arg) +status_timer_callback(__unused int fd, __unused short events, void *arg) { struct client *c = arg; struct session *s = c->session; @@ -604,7 +604,7 @@ status_message_clear(struct client *c) /* Clear status line message after timer expires. */ void -status_message_callback(unused int fd, unused short event, void *data) +status_message_callback(__unused int fd, __unused short event, void *data) { struct client *c = data; diff --git a/tmux.h b/tmux.h index 421f2369..b6cdcd80 100644 --- a/tmux.h +++ b/tmux.h @@ -69,9 +69,6 @@ struct tmuxproc; #define READ_BACKOFF 512 #define READ_TIME 100 -/* Definition to shut gcc up about unused arguments. */ -#define unused __attribute__ ((unused)) - /* Attribute to make gcc check printf-like arguments. */ #define printflike(a, b) __attribute__ ((format (printf, a, b))) diff --git a/tty-keys.c b/tty-keys.c index 52dae4f7..706dcc30 100644 --- a/tty-keys.c +++ b/tty-keys.c @@ -635,7 +635,7 @@ discard_key: /* Key timer callback. */ void -tty_keys_callback(unused int fd, unused short events, void *data) +tty_keys_callback(__unused int fd, __unused short events, void *data) { struct tty *tty = data; diff --git a/tty.c b/tty.c index e67ebbb6..13ca7f8e 100644 --- a/tty.c +++ b/tty.c @@ -172,7 +172,7 @@ tty_open(struct tty *tty, char **cause) } void -tty_read_callback(unused struct bufferevent *bufev, void *data) +tty_read_callback(__unused struct bufferevent *bufev, void *data) { struct tty *tty = data; @@ -181,8 +181,8 @@ tty_read_callback(unused struct bufferevent *bufev, void *data) } void -tty_error_callback( - unused struct bufferevent *bufev, unused short what, unused void *data) +tty_error_callback(__unused struct bufferevent *bufev, __unused short what, + __unused void *data) { } @@ -591,7 +591,7 @@ tty_repeat_space(struct tty *tty, u_int n) * pane. */ int -tty_large_region(unused struct tty *tty, const struct tty_ctx *ctx) +tty_large_region(__unused struct tty *tty, const struct tty_ctx *ctx) { struct window_pane *wp = ctx->wp; diff --git a/window-choose.c b/window-choose.c index 5f406c78..cab3e5d8 100644 --- a/window-choose.c +++ b/window-choose.c @@ -509,8 +509,8 @@ window_choose_get_item(struct window_pane *wp, key_code key, } void -window_choose_key(struct window_pane *wp, unused struct client *c, - unused struct session *sess, key_code key, struct mouse_event *m) +window_choose_key(struct window_pane *wp, __unused struct client *c, + __unused struct session *sess, key_code key, struct mouse_event *m) { struct window_choose_mode_data *data = wp->modedata; struct screen *s = &data->screen; diff --git a/window-clock.c b/window-clock.c index 51f97250..e8451f22 100644 --- a/window-clock.c +++ b/window-clock.c @@ -120,7 +120,7 @@ const char window_clock_table[14][5][5] = { }; void -window_clock_timer_callback(unused int fd, unused short events, void *arg) +window_clock_timer_callback(__unused int fd, __unused short events, void *arg) { struct window_pane *wp = arg; struct window_clock_mode_data *data = wp->modedata; @@ -185,9 +185,9 @@ window_clock_resize(struct window_pane *wp, u_int sx, u_int sy) } void -window_clock_key(struct window_pane *wp, unused struct client *c, - unused struct session *sess, unused key_code key, - unused struct mouse_event *m) +window_clock_key(struct window_pane *wp, __unused struct client *c, + __unused struct session *sess, __unused key_code key, + __unused struct mouse_event *m) { window_pane_reset_mode(wp); } diff --git a/window-copy.c b/window-copy.c index a28cdecc..37025302 100644 --- a/window-copy.c +++ b/window-copy.c @@ -2232,7 +2232,7 @@ window_copy_rectangle_toggle(struct window_pane *wp) } void -window_copy_start_drag(struct client *c, unused struct mouse_event *m) +window_copy_start_drag(struct client *c, struct mouse_event *m) { struct window_pane *wp; u_int x, y; @@ -2253,7 +2253,7 @@ window_copy_start_drag(struct client *c, unused struct mouse_event *m) } void -window_copy_drag_update(unused struct client *c, struct mouse_event *m) +window_copy_drag_update(__unused struct client *c, struct mouse_event *m) { struct window_pane *wp; struct window_copy_mode_data *data; @@ -2274,7 +2274,7 @@ window_copy_drag_update(unused struct client *c, struct mouse_event *m) } void -window_copy_drag_release(unused struct client *c, struct mouse_event *m) +window_copy_drag_release(__unused struct client *c, struct mouse_event *m) { struct window_pane *wp; diff --git a/window.c b/window.c index c5f9f176..8ee517a1 100644 --- a/window.c +++ b/window.c @@ -916,13 +916,13 @@ window_pane_spawn(struct window_pane *wp, int argc, char **argv, } void -window_pane_timer_callback(unused int fd, unused short events, void *data) +window_pane_timer_callback(__unused int fd, __unused short events, void *data) { window_pane_read_callback(NULL, data); } void -window_pane_read_callback(unused struct bufferevent *bufev, void *data) +window_pane_read_callback(__unused struct bufferevent *bufev, void *data) { struct window_pane *wp = data; struct evbuffer *evb = wp->event->input; @@ -968,8 +968,8 @@ start_timer: } void -window_pane_error_callback(unused struct bufferevent *bufev, unused short what, - void *data) +window_pane_error_callback(__unused struct bufferevent *bufev, + __unused short what, void *data) { struct window_pane *wp = data;