mirror of
https://github.com/neovim/neovim.git
synced 2025-09-15 15:58:17 +00:00
pty_process: Make termios structure a static variable
The structure has a constant initializer and is only used for reading.
This commit is contained in:
@@ -36,12 +36,15 @@
|
|||||||
bool pty_process_spawn(PtyProcess *ptyproc)
|
bool pty_process_spawn(PtyProcess *ptyproc)
|
||||||
FUNC_ATTR_NONNULL_ALL
|
FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
|
static struct termios termios;
|
||||||
|
if (!termios.c_cflag) {
|
||||||
|
init_termios(&termios);
|
||||||
|
}
|
||||||
|
|
||||||
Process *proc = (Process *)ptyproc;
|
Process *proc = (Process *)ptyproc;
|
||||||
assert(!proc->err);
|
assert(!proc->err);
|
||||||
uv_signal_start(&proc->loop->children_watcher, chld_handler, SIGCHLD);
|
uv_signal_start(&proc->loop->children_watcher, chld_handler, SIGCHLD);
|
||||||
ptyproc->winsize = (struct winsize){ptyproc->height, ptyproc->width, 0, 0};
|
ptyproc->winsize = (struct winsize){ptyproc->height, ptyproc->width, 0, 0};
|
||||||
struct termios termios;
|
|
||||||
init_termios(&termios);
|
|
||||||
uv_disable_stdio_inheritance();
|
uv_disable_stdio_inheritance();
|
||||||
int master;
|
int master;
|
||||||
int pid = forkpty(&master, NULL, &termios, &ptyproc->winsize);
|
int pid = forkpty(&master, NULL, &termios, &ptyproc->winsize);
|
||||||
@@ -136,7 +139,6 @@ static void init_child(PtyProcess *ptyproc) FUNC_ATTR_NONNULL_ALL
|
|||||||
|
|
||||||
static void init_termios(struct termios *termios) FUNC_ATTR_NONNULL_ALL
|
static void init_termios(struct termios *termios) FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
memset(termios, 0, sizeof(struct termios));
|
|
||||||
// Taken from pangoterm
|
// Taken from pangoterm
|
||||||
termios->c_iflag = ICRNL|IXON;
|
termios->c_iflag = ICRNL|IXON;
|
||||||
termios->c_oflag = OPOST|ONLCR;
|
termios->c_oflag = OPOST|ONLCR;
|
||||||
|
Reference in New Issue
Block a user