mirror of
https://github.com/neovim/neovim.git
synced 2025-10-17 15:21:47 +00:00
*: Rename main loop variable from loop to main_loop
Current name is inappropriate for the following reasons: 1. It is often masked by local `loop` variables. 2. It cannot be searched for. There are many `loop` variables where `loop` is some local variable. There are many cases when “loop” word is used in a comment. 3. It is in any case bad idea to use a generic name as a name of the global variable. Best if global has module prefix: this is why it is in `main.h`: `main_loop` both stands for “a main loop” and “a loop defined in `main.*`”. Since I have no idea how to list every occurrence of this variable method used to rename it is “remove it from globals.h, try to compile, fix errors”. Thus if some occurrence was hidden under false `#if` branch it was not replaced.
This commit is contained in:
@@ -60,7 +60,7 @@ void input_start(int fd)
|
||||
}
|
||||
|
||||
global_fd = fd;
|
||||
rstream_init_fd(&loop, &read_stream, fd, READ_BUFFER_SIZE, NULL);
|
||||
rstream_init_fd(&main_loop, &read_stream, fd, READ_BUFFER_SIZE, NULL);
|
||||
rstream_start(&read_stream, read_cb);
|
||||
}
|
||||
|
||||
@@ -87,8 +87,8 @@ static void create_cursorhold_event(void)
|
||||
// have been called(inbuf_poll would return kInputAvail)
|
||||
// TODO(tarruda): Cursorhold should be implemented as a timer set during the
|
||||
// `state_check` callback for the states where it can be triggered.
|
||||
assert(!events_enabled || queue_empty(loop.events));
|
||||
queue_put(loop.events, cursorhold_event, 0);
|
||||
assert(!events_enabled || queue_empty(main_loop.events));
|
||||
queue_put(main_loop.events, cursorhold_event, 0);
|
||||
}
|
||||
|
||||
// Low level input function
|
||||
@@ -147,7 +147,7 @@ bool os_char_avail(void)
|
||||
void os_breakcheck(void)
|
||||
{
|
||||
if (!got_int) {
|
||||
loop_poll_events(&loop, 0);
|
||||
loop_poll_events(&main_loop, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,7 +322,7 @@ static bool input_poll(int ms)
|
||||
prof_inchar_enter();
|
||||
}
|
||||
|
||||
LOOP_PROCESS_EVENTS_UNTIL(&loop, NULL, ms, input_ready() || input_eof);
|
||||
LOOP_PROCESS_EVENTS_UNTIL(&main_loop, NULL, ms, input_ready() || input_eof);
|
||||
|
||||
if (do_profiling == PROF_YES && ms) {
|
||||
prof_inchar_exit();
|
||||
@@ -419,5 +419,5 @@ static void read_error_exit(void)
|
||||
|
||||
static bool pending_events(void)
|
||||
{
|
||||
return events_enabled && !queue_empty(loop.events);
|
||||
return events_enabled && !queue_empty(main_loop.events);
|
||||
}
|
||||
|
Reference in New Issue
Block a user