patch 8.1.1983: compiler nags for uninitialized variable and unused function

Problem:    Compiler nags for uninitialized variable and unused function.
Solution:   Add unnecessary initialization.  Move function inside #ifdef.
This commit is contained in:
Bram Moolenaar
2019-09-04 18:53:12 +02:00
parent 6a124e622c
commit ea781459b9
3 changed files with 36 additions and 40 deletions

View File

@ -55,9 +55,6 @@
#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);
@ -506,6 +503,30 @@ free_unused_channels(int copyID, int mask)
#if defined(FEAT_GUI) || defined(PROTO)
# if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK)
/*
* Lookup the channel from the socket. Set "partp" to the fd index.
* Returns NULL when the socket isn't found.
*/
static channel_T *
channel_fd2channel(sock_T fd, ch_part_T *partp)
{
channel_T *channel;
ch_part_T part;
if (fd != INVALID_FD)
for (channel = first_channel; channel != NULL;
channel = channel->ch_next)
{
for (part = PART_SOCK; part < PART_IN; ++part)
if (channel->ch_part[part].ch_fd == fd)
{
*partp = part;
return channel;
}
}
return NULL;
}
static void
channel_read_fd(int fd)
{
@ -674,7 +695,7 @@ channel_gui_unregister(channel_T *channel)
channel_gui_unregister_one(channel, part);
}
#endif
#endif // FEAT_GUI
static char *e_cannot_connect = N_("E902: Cannot connect to port");
@ -3764,33 +3785,6 @@ theend:
free_job_options(&opt);
}
# if defined(MSWIN) || defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) \
|| defined(PROTO)
/*
* Lookup the channel from the socket. Set "partp" to the fd index.
* Returns NULL when the socket isn't found.
*/
static channel_T *
channel_fd2channel(sock_T fd, ch_part_T *partp)
{
channel_T *channel;
ch_part_T part;
if (fd != INVALID_FD)
for (channel = first_channel; channel != NULL;
channel = channel->ch_next)
{
for (part = PART_SOCK; part < PART_IN; ++part)
if (channel->ch_part[part].ch_fd == fd)
{
*partp = part;
return channel;
}
}
return NULL;
}
# endif
# if defined(MSWIN) || defined(FEAT_GUI) || defined(PROTO)
/*
* Check the channels for anything that is ready to be read.

View File

@ -2716,7 +2716,7 @@ add_text_props_for_append(
int count;
int n;
char_u *props;
int new_len;
int new_len = 0; // init for gcc
char_u *new_line;
textprop_T prop;

View File

@ -757,6 +757,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1983,
/**/
1982,
/**/