Change enum to a name that follows naming convention

This commit is contained in:
erw7 2019-11-16 13:16:52 +09:00 committed by Björn Linse
parent 59ae38a919
commit 60c7eabb2f
2 changed files with 12 additions and 12 deletions

View File

@ -24,7 +24,7 @@ static void CALLBACK pty_process_finish1(void *context, BOOLEAN unused)
PtyProcess *ptyproc = (PtyProcess *)context;
Process *proc = (Process *)ptyproc;
if (ptyproc->type == PTY_TYPE_CONPTY
if (ptyproc->type == kConpty
&& ptyproc->object.conpty != NULL) {
os_conpty_free(ptyproc->object.conpty);
ptyproc->object.conpty = NULL;
@ -61,11 +61,11 @@ int pty_process_spawn(PtyProcess *ptyproc)
if ((conpty_object =
os_conpty_init(&in_name, &out_name,
ptyproc->width, ptyproc->height)) != NULL) {
ptyproc->type = PTY_TYPE_CONPTY;
ptyproc->type = kConpty;
}
}
if (ptyproc->type == PTY_TYPE_WINPTY) {
if (ptyproc->type == kWinpty) {
cfg = winpty_config_new(WINPTY_FLAG_ALLOW_CURPROC_DESKTOP_CREATION, &err);
if (cfg == NULL) {
emsg = "winpty_config_new failed";
@ -125,7 +125,7 @@ int pty_process_spawn(PtyProcess *ptyproc)
goto cleanup;
}
if (ptyproc->type == PTY_TYPE_CONPTY) {
if (ptyproc->type == kConpty) {
if (!os_conpty_spawn(conpty_object,
&process_handle,
NULL,
@ -183,7 +183,7 @@ int pty_process_spawn(PtyProcess *ptyproc)
uv_run(&proc->loop->uv, UV_RUN_ONCE);
}
(ptyproc->type == PTY_TYPE_CONPTY) ?
(ptyproc->type == kConpty) ?
(void *)(ptyproc->object.conpty = conpty_object) :
(void *)(ptyproc->object.winpty = winpty_object);
ptyproc->process_handle = process_handle;
@ -227,7 +227,7 @@ void pty_process_resize(PtyProcess *ptyproc, uint16_t width,
uint16_t height)
FUNC_ATTR_NONNULL_ALL
{
if (ptyproc->type == PTY_TYPE_CONPTY
if (ptyproc->type == kConpty
&& ptyproc->object.conpty != NULL) {
os_conpty_set_size(ptyproc->object.conpty, width, height);
} else if (ptyproc->object.winpty != NULL) {
@ -250,7 +250,7 @@ void pty_process_close(PtyProcess *ptyproc)
void pty_process_close_master(PtyProcess *ptyproc)
FUNC_ATTR_NONNULL_ALL
{
if (ptyproc->type == PTY_TYPE_WINPTY
if (ptyproc->type == kWinpty
&& ptyproc->object.winpty != NULL) {
winpty_free(ptyproc->object.winpty);
ptyproc->object.winpty = NULL;

View File

@ -9,9 +9,9 @@
#include "nvim/os/os_win_conpty.h"
typedef enum {
PTY_TYPE_WINPTY,
PTY_TYPE_CONPTY
} pty_type_t;
kWinpty,
kConpty
} PtyType;
typedef struct pty_process {
Process process;
@ -21,7 +21,7 @@ typedef struct pty_process {
winpty_t *winpty;
conpty_t *conpty;
} object;
pty_type_t type;
PtyType type;
HANDLE finish_wait;
HANDLE process_handle;
uv_timer_t wait_eof_timer;
@ -41,7 +41,7 @@ static inline PtyProcess pty_process_init(Loop *loop, void *data)
rv.width = 80;
rv.height = 24;
rv.object.winpty = NULL;
rv.type = PTY_TYPE_WINPTY;
rv.type = kWinpty;
rv.finish_wait = NULL;
rv.process_handle = NULL;
return rv;