aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/input.c
diff options
context:
space:
mode:
authorPavel Platto <hinidu@gmail.com>2014-07-13 10:03:07 +0300
committerNicolas Hillegeer <nicolas@hillegeer.com>2014-07-14 20:28:40 +0200
commit47084ea7657121837536d409b9137fd38426aeef (patch)
tree1bf014cf8e25a6875bc49328deafbfc9f5e0ef88 /src/nvim/os/input.c
parent2dc69700ec9a01b3b7cd4823e8cd3ad5431b9410 (diff)
downloadrneovim-47084ea7657121837536d409b9137fd38426aeef.tar.gz
rneovim-47084ea7657121837536d409b9137fd38426aeef.tar.bz2
rneovim-47084ea7657121837536d409b9137fd38426aeef.zip
Use strict function prototypes #945
`-Wstrict-prototypes` warn if a function is declared or defined without specifying the argument types. This warning disallow function prototypes with empty parameter list. In C, a function declared with an empty parameter list accepts an arbitrary number of arguments when being called. This is for historic reasons; originally, C functions didn't have prototypes, as C evolved from B, a typeless language. When prototypes were added, the original typeless declarations were left in the language for backwards compatibility. Instead we should provide `void` in argument list to state that function doesn't have arguments. Also this warning disallow declaring type of the parameters after the parentheses because Neovim header generator produce no declarations for old-stlyle prototypes: it expects to find `{` after prototype.
Diffstat (limited to 'src/nvim/os/input.c')
-rw-r--r--src/nvim/os/input.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/nvim/os/input.c b/src/nvim/os/input.c
index 504aeafbc1..58bdf0cf52 100644
--- a/src/nvim/os/input.c
+++ b/src/nvim/os/input.c
@@ -32,20 +32,20 @@ static bool eof = false, started_reading = false;
// Helper function used to push bytes from the 'event' key sequence partially
// between calls to os_inchar when maxlen < 3
-void input_init()
+void input_init(void)
{
read_stream = rstream_new(read_cb, READ_BUFFER_SIZE, NULL, false);
rstream_set_file(read_stream, read_cmd_fd);
}
// Listen for input
-void input_start()
+void input_start(void)
{
rstream_start(read_stream);
}
// Stop listening for input
-void input_stop()
+void input_stop(void)
{
rstream_stop(read_stream);
}
@@ -105,14 +105,14 @@ int os_inchar(uint8_t *buf, int maxlen, int32_t ms, int tb_change_cnt)
}
// Check if a character is available for reading
-bool os_char_avail()
+bool os_char_avail(void)
{
return inbuf_poll(0) == kInputAvail;
}
// Check for CTRL-C typed by reading all available characters.
// In cooked mode we should get SIGINT, no need to check.
-void os_breakcheck()
+void os_breakcheck(void)
{
if (curr_tmode == TMODE_RAW && input_poll(0))
fill_input_buf(false);
@@ -148,7 +148,7 @@ static InbufPollResult inbuf_poll(int32_t ms)
return kInputNone;
}
-static void stderr_switch()
+static void stderr_switch(void)
{
int mode = cur_tmode;
// We probably set the wrong file descriptor to raw mode. Switch back to
@@ -198,7 +198,7 @@ static int push_event_key(uint8_t *buf, int maxlen)
}
// Check if there's pending input
-bool input_ready()
+bool input_ready(void)
{
return rstream_available(read_stream) > 0 || eof;
}