1
0
mirror of https://github.com/tmux/tmux.git synced 2025-03-25 15:28:49 +00:00

Make options_get_string return const string.

This commit is contained in:
nicm 2017-01-13 11:56:43 +00:00
parent 95950bf668
commit 22a528905d
6 changed files with 25 additions and 23 deletions

View File

@ -74,8 +74,8 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
struct environ *env; struct environ *env;
struct termios tio, *tiop; struct termios tio, *tiop;
const char *newname, *target, *update, *errstr, *template; const char *newname, *target, *update, *errstr, *template;
const char *path, *cwd, *to_free = NULL; const char *path, *cmd, *cwd, *to_free = NULL;
char **argv, *cmd, *cause, *cp; char **argv, *cause, *cp;
int detached, already_attached, idx, argc; int detached, already_attached, idx, argc;
u_int sx, sy; u_int sx, sy;
struct format_tree *ft; struct format_tree *ft;
@ -217,7 +217,7 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
cmd = options_get_string(global_s_options, "default-command"); cmd = options_get_string(global_s_options, "default-command");
if (cmd != NULL && *cmd != '\0') { if (cmd != NULL && *cmd != '\0') {
argc = 1; argc = 1;
argv = &cmd; argv = (char **)&cmd;
} else { } else {
argc = 0; argc = 0;
argv = NULL; argv = NULL;

View File

@ -121,7 +121,8 @@ static char *
format_window_name(struct window *w) format_window_name(struct window *w)
{ {
struct format_tree *ft; struct format_tree *ft;
char *fmt, *name; const char *fmt;
char *name;
ft = format_create(NULL, 0); ft = format_create(NULL, 0);
format_defaults_window(ft, w); format_defaults_window(ft, w);

View File

@ -296,12 +296,13 @@ server_client_detach(struct client *c, enum msgtype msgtype)
proc_send_s(c->peer, msgtype, s->name); proc_send_s(c->peer, msgtype, s->name);
} }
/* Execute command to replace a client, */ /* Execute command to replace a client. */
void void
server_client_exec(struct client *c, const char *cmd) server_client_exec(struct client *c, const char *cmd)
{ {
struct session *s = c->session; struct session *s = c->session;
char *msg, *shell; char *msg;
const char *shell;
size_t cmdsize, shellsize; size_t cmdsize, shellsize;
if (*cmd == '\0') if (*cmd == '\0')

View File

@ -35,9 +35,9 @@ static void server_destroy_session_group(struct session *);
void void
server_fill_environ(struct session *s, struct environ *env) server_fill_environ(struct session *s, struct environ *env)
{ {
char *term; const char *term;
u_int idx; u_int idx;
long pid; long pid;
if (s != NULL) { if (s != NULL) {
term = options_get_string(global_options, "default-terminal"); term = options_get_string(global_options, "default-terminal");

View File

@ -278,18 +278,19 @@ status_get_window_at(struct client *c, u_int x)
int int
status_redraw(struct client *c) status_redraw(struct client *c)
{ {
struct screen_write_ctx ctx; struct screen_write_ctx ctx;
struct session *s = c->session; struct session *s = c->session;
struct winlink *wl; struct winlink *wl;
struct screen old_status, window_list; struct screen old_status, window_list;
struct grid_cell stdgc, lgc, rgc, gc; struct grid_cell stdgc, lgc, rgc, gc;
struct options *oo; struct options *oo;
time_t t; time_t t;
char *left, *right, *sep; char *left, *right;
u_int offset, needed; const char *sep;
u_int wlstart, wlwidth, wlavailable, wloffset, wlsize; u_int offset, needed;
size_t llen, rlen, seplen; u_int wlstart, wlwidth, wlavailable, wloffset, wlsize;
int larrow, rarrow; size_t llen, rlen, seplen;
int larrow, rarrow;
/* No status line? */ /* No status line? */
if (c->tty.sy == 0 || !options_get_number(s->options, "status")) if (c->tty.sy == 0 || !options_get_number(s->options, "status"))

View File

@ -385,8 +385,7 @@ tty_term_find(char *name, int fd, char **cause)
struct tty_code *code; struct tty_code *code;
u_int i; u_int i;
int n, error; int n, error;
char *s; const char *s, *acs;
const char *acs;
LIST_FOREACH(term, &tty_terms, entry) { LIST_FOREACH(term, &tty_terms, entry) {
if (strcmp(term->name, name) == 0) { if (strcmp(term->name, name) == 0) {