None of the server message functions return anything but 0, so make them all

void.

Also remove a leftover variable in client.c.
This commit is contained in:
Nicholas Marriott 2009-07-23 21:19:11 +00:00
parent 16e017d5a6
commit 4a04b498db
2 changed files with 16 additions and 31 deletions

View File

@ -134,14 +134,12 @@ int
client_main(struct client_ctx *cctx) client_main(struct client_ctx *cctx)
{ {
struct pollfd pfd; struct pollfd pfd;
char *error;
int xtimeout; /* Yay for ncurses namespace! */ int xtimeout; /* Yay for ncurses namespace! */
siginit(); siginit();
logfile("client"); logfile("client");
error = NULL;
while (!sigterm) { while (!sigterm) {
if (sigchld) { if (sigchld) {
waitpid(WAIT_ANY, NULL, WNOHANG); waitpid(WAIT_ANY, NULL, WNOHANG);

View File

@ -26,12 +26,12 @@
#include "tmux.h" #include "tmux.h"
int server_msg_fn_command(struct hdr *, struct client *); void server_msg_fn_command(struct hdr *, struct client *);
int server_msg_fn_identify(struct hdr *, struct client *); void server_msg_fn_identify(struct hdr *, struct client *);
int server_msg_fn_resize(struct hdr *, struct client *); void server_msg_fn_resize(struct hdr *, struct client *);
int server_msg_fn_exiting(struct hdr *, struct client *); void server_msg_fn_exiting(struct hdr *, struct client *);
int server_msg_fn_unlock(struct hdr *, struct client *); void server_msg_fn_unlock(struct hdr *, struct client *);
int server_msg_fn_wakeup(struct hdr *, struct client *); void server_msg_fn_wakeup(struct hdr *, struct client *);
void printflike2 server_msg_fn_command_error( void printflike2 server_msg_fn_command_error(
struct cmd_ctx *, const char *, ...); struct cmd_ctx *, const char *, ...);
@ -42,7 +42,7 @@ void printflike2 server_msg_fn_command_info(
struct server_msg { struct server_msg {
enum hdrtype type; enum hdrtype type;
int (*fn)(struct hdr *, struct client *); void (*fn)(struct hdr *, struct client *);
}; };
const struct server_msg server_msg_table[] = { const struct server_msg server_msg_table[] = {
{ MSG_IDENTIFY, server_msg_fn_identify }, { MSG_IDENTIFY, server_msg_fn_identify },
@ -59,7 +59,6 @@ server_msg_dispatch(struct client *c)
struct hdr hdr; struct hdr hdr;
const struct server_msg *msg; const struct server_msg *msg;
u_int i; u_int i;
int n;
for (;;) { for (;;) {
if (BUFFER_USED(c->in) < sizeof hdr) if (BUFFER_USED(c->in) < sizeof hdr)
@ -72,8 +71,7 @@ server_msg_dispatch(struct client *c)
for (i = 0; i < nitems(server_msg_table); i++) { for (i = 0; i < nitems(server_msg_table); i++) {
msg = server_msg_table + i; msg = server_msg_table + i;
if (msg->type == hdr.type) { if (msg->type == hdr.type) {
if ((n = msg->fn(&hdr, c)) != 0) msg->fn(&hdr, c);
return (n);
break; break;
} }
} }
@ -127,7 +125,7 @@ server_msg_fn_command_info(struct cmd_ctx *ctx, const char *fmt, ...)
xfree(msg); xfree(msg);
} }
int void
server_msg_fn_command(struct hdr *hdr, struct client *c) server_msg_fn_command(struct hdr *hdr, struct client *c)
{ {
struct msg_command_data data; struct msg_command_data data;
@ -160,7 +158,7 @@ server_msg_fn_command(struct hdr *hdr, struct client *c)
"unset $TMUX to force"); "unset $TMUX to force");
cmd_list_free(cmdlist); cmd_list_free(cmdlist);
server_write_client(c, MSG_EXIT, NULL, 0); server_write_client(c, MSG_EXIT, NULL, 0);
return (0); return;
} }
} }
} }
@ -168,10 +166,9 @@ server_msg_fn_command(struct hdr *hdr, struct client *c)
if (cmd_list_exec(cmdlist, &ctx) != 1) if (cmd_list_exec(cmdlist, &ctx) != 1)
server_write_client(c, MSG_EXIT, NULL, 0); server_write_client(c, MSG_EXIT, NULL, 0);
cmd_list_free(cmdlist); cmd_list_free(cmdlist);
return (0);
} }
int void
server_msg_fn_identify(struct hdr *hdr, struct client *c) server_msg_fn_identify(struct hdr *hdr, struct client *c)
{ {
struct msg_identify_data data; struct msg_identify_data data;
@ -190,7 +187,7 @@ server_msg_fn_identify(struct hdr *hdr, struct client *c)
server_write_client(c, MSG_ERROR, MSG, (sizeof MSG) - 1); server_write_client(c, MSG_ERROR, MSG, (sizeof MSG) - 1);
#undef MSG #undef MSG
server_write_client(c, MSG_EXIT, NULL, 0); server_write_client(c, MSG_EXIT, NULL, 0);
return (0); return;
} }
c->tty.sx = data.sx; c->tty.sx = data.sx;
@ -216,11 +213,9 @@ server_msg_fn_identify(struct hdr *hdr, struct client *c)
xfree(term); xfree(term);
c->flags |= CLIENT_TERMINAL; c->flags |= CLIENT_TERMINAL;
return (0);
} }
int void
server_msg_fn_resize(struct hdr *hdr, struct client *c) server_msg_fn_resize(struct hdr *hdr, struct client *c)
{ {
struct msg_resize_data data; struct msg_resize_data data;
@ -247,11 +242,9 @@ server_msg_fn_resize(struct hdr *hdr, struct client *c)
/* Always redraw this client. */ /* Always redraw this client. */
server_redraw_client(c); server_redraw_client(c);
return (0);
} }
int void
server_msg_fn_exiting(struct hdr *hdr, struct client *c) server_msg_fn_exiting(struct hdr *hdr, struct client *c)
{ {
if (hdr->size != 0) if (hdr->size != 0)
@ -264,11 +257,9 @@ server_msg_fn_exiting(struct hdr *hdr, struct client *c)
tty_close(&c->tty, c->flags & CLIENT_SUSPENDED); tty_close(&c->tty, c->flags & CLIENT_SUSPENDED);
server_write_client(c, MSG_EXITED, NULL, 0); server_write_client(c, MSG_EXITED, NULL, 0);
return (0);
} }
int void
server_msg_fn_unlock(struct hdr *hdr, struct client *c) server_msg_fn_unlock(struct hdr *hdr, struct client *c)
{ {
char *pass; char *pass;
@ -289,11 +280,9 @@ server_msg_fn_unlock(struct hdr *hdr, struct client *c)
memset(pass, 0, strlen(pass)); memset(pass, 0, strlen(pass));
xfree(pass); xfree(pass);
return (0);
} }
int void
server_msg_fn_wakeup(struct hdr *hdr, struct client *c) server_msg_fn_wakeup(struct hdr *hdr, struct client *c)
{ {
if (hdr->size != 0) if (hdr->size != 0)
@ -304,6 +293,4 @@ server_msg_fn_wakeup(struct hdr *hdr, struct client *c)
c->flags &= ~CLIENT_SUSPENDED; c->flags &= ~CLIENT_SUSPENDED;
tty_start_tty(&c->tty); tty_start_tty(&c->tty);
server_redraw_client(c); server_redraw_client(c);
return (0);
} }