patch 8.1.1891: functions used in one file are global
Problem: Functions used in one file are global.
Solution: Add "static". (Yegappan Lakshmanan, closes #4840)
diff --git a/src/channel.c b/src/channel.c
index 8b0abdc..a023c9f 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -55,6 +55,14 @@
#endif
static void channel_read(channel_T *channel, ch_part_T part, char *func);
+# if defined(MSWIN) || defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK)
+static channel_T *channel_fd2channel(sock_T fd, ch_part_T *partp);
+# endif
+static ch_mode_T channel_get_mode(channel_T *channel, ch_part_T part);
+static int channel_get_timeout(channel_T *channel, ch_part_T part);
+static ch_part_T channel_part_send(channel_T *channel);
+static ch_part_T channel_part_read(channel_T *channel);
+static void free_job_options(jobopt_T *opt);
/* Whether a redraw is needed for appending a line to a buffer. */
static int channel_need_redraw = FALSE;
@@ -1175,7 +1183,7 @@
/*
* Implements ch_open().
*/
- channel_T *
+ static channel_T *
channel_open_func(typval_T *argvars)
{
char_u *address;
@@ -1348,7 +1356,7 @@
/*
* Set the callback for "channel"/"part" for the response with "id".
*/
- void
+ static void
channel_set_req_callback(
channel_T *channel,
ch_part_T part,
@@ -2848,7 +2856,7 @@
/*
* Return TRUE if "channel" has JSON or other typeahead.
*/
- int
+ static int
channel_has_readahead(channel_T *channel, ch_part_T part)
{
ch_mode_T ch_mode = channel->ch_part[part].ch_mode;
@@ -2959,7 +2967,7 @@
dict_add_number(dict, namebuf, chanpart->ch_timeout);
}
- void
+ static void
channel_info(channel_T *channel, dict_T *dict)
{
dict_add_number(dict, "id", channel->ch_id);
@@ -3067,7 +3075,7 @@
/*
* Close the "in" part channel "channel".
*/
- void
+ static void
channel_close_in(channel_T *channel)
{
ch_close_part(channel, PART_IN);
@@ -3676,7 +3684,7 @@
/*
* Common for ch_read() and ch_readraw().
*/
- void
+ static void
common_channel_read(typval_T *argvars, typval_T *rettv, int raw, int blob)
{
channel_T *channel;
@@ -3762,7 +3770,7 @@
* Lookup the channel from the socket. Set "partp" to the fd index.
* Returns NULL when the socket isn't found.
*/
- channel_T *
+ static channel_T *
channel_fd2channel(sock_T fd, ch_part_T *partp)
{
channel_T *channel;
@@ -4092,7 +4100,7 @@
/*
* common for "ch_evalexpr()" and "ch_sendexpr()"
*/
- void
+ static void
ch_expr_common(typval_T *argvars, typval_T *rettv, int eval)
{
char_u *text;
@@ -4154,7 +4162,7 @@
/*
* common for "ch_evalraw()" and "ch_sendraw()"
*/
- void
+ static void
ch_raw_common(typval_T *argvars, typval_T *rettv, int eval)
{
char_u buf[NUMBUFLEN];
@@ -4540,7 +4548,7 @@
/*
* Return the "part" to write to for "channel".
*/
- ch_part_T
+ static ch_part_T
channel_part_send(channel_T *channel)
{
if (channel->CH_SOCK_FD == INVALID_FD)
@@ -4551,7 +4559,7 @@
/*
* Return the default "part" to read from for "channel".
*/
- ch_part_T
+ static ch_part_T
channel_part_read(channel_T *channel)
{
if (channel->CH_SOCK_FD == INVALID_FD)
@@ -4563,7 +4571,7 @@
* Return the mode of "channel"/"part"
* If "channel" is invalid returns MODE_JSON.
*/
- ch_mode_T
+ static ch_mode_T
channel_get_mode(channel_T *channel, ch_part_T part)
{
if (channel == NULL)
@@ -4574,7 +4582,7 @@
/*
* Return the timeout of "channel"/"part"
*/
- int
+ static int
channel_get_timeout(channel_T *channel, ch_part_T part)
{
return channel->ch_part[part].ch_timeout;
@@ -4638,7 +4646,7 @@
/*
* Free any members of a jobopt_T.
*/
- void
+ static void
free_job_options(jobopt_T *opt)
{
if (opt->jo_callback.cb_partial != NULL)
@@ -5309,7 +5317,7 @@
}
}
-job_T *jobs_to_free = NULL;
+static job_T *jobs_to_free = NULL;
/*
* Put "job" in a list to be freed later, when it's no longer referenced.