To: vim_dev@googlegroups.com Subject: Patch 8.1.1983 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1983 Problem: Compiler nags for uninitialized variable and unused function. Solution: Add unnecessary initialization. Move function inside #ifdef. Files: src/memline.c, src/channel.c *** ../vim-8.1.1982/src/memline.c 2019-08-04 20:42:39.815198862 +0200 --- src/memline.c 2019-09-04 18:19:13.085407056 +0200 *************** *** 2716,2722 **** int count; int n; char_u *props; ! int new_len; char_u *new_line; textprop_T prop; --- 2716,2722 ---- int count; int n; char_u *props; ! int new_len = 0; // init for gcc char_u *new_line; textprop_T prop; *** ../vim-8.1.1982/src/channel.c 2019-08-20 20:13:40.322821973 +0200 --- src/channel.c 2019-09-04 18:52:03.009349877 +0200 *************** *** 55,63 **** #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); --- 55,60 ---- *************** *** 505,511 **** #if defined(FEAT_GUI) || defined(PROTO) ! #if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) static void channel_read_fd(int fd) { --- 502,532 ---- #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) { *************** *** 518,529 **** else channel_read(channel, part, "channel_read_fd"); } ! #endif /* * Read a command from netbeans. */ ! #ifdef FEAT_GUI_X11 static void messageFromServerX11(XtPointer clientData, int *unused1 UNUSED, --- 539,550 ---- else channel_read(channel, part, "channel_read_fd"); } ! # endif /* * Read a command from netbeans. */ ! # ifdef FEAT_GUI_X11 static void messageFromServerX11(XtPointer clientData, int *unused1 UNUSED, *************** *** 531,540 **** { channel_read_fd((int)(long)clientData); } ! #endif ! #ifdef FEAT_GUI_GTK ! # if GTK_CHECK_VERSION(3,0,0) static gboolean messageFromServerGtk3(GIOChannel *unused1 UNUSED, GIOCondition unused2 UNUSED, --- 552,561 ---- { channel_read_fd((int)(long)clientData); } ! # endif ! # ifdef FEAT_GUI_GTK ! # if GTK_CHECK_VERSION(3,0,0) static gboolean messageFromServerGtk3(GIOChannel *unused1 UNUSED, GIOCondition unused2 UNUSED, *************** *** 544,550 **** return TRUE; /* Return FALSE instead in case the event source is to * be removed after this function returns. */ } ! # else static void messageFromServerGtk2(gpointer clientData, gint unused1 UNUSED, --- 565,571 ---- return TRUE; /* Return FALSE instead in case the event source is to * be removed after this function returns. */ } ! # else static void messageFromServerGtk2(gpointer clientData, gint unused1 UNUSED, *************** *** 552,559 **** { channel_read_fd((int)(long)clientData); } # endif - #endif static void channel_gui_register_one(channel_T *channel, ch_part_T part) --- 573,580 ---- { channel_read_fd((int)(long)clientData); } + # endif # endif static void channel_gui_register_one(channel_T *channel, ch_part_T part) *************** *** 674,680 **** channel_gui_unregister_one(channel, part); } ! #endif static char *e_cannot_connect = N_("E902: Cannot connect to port"); --- 695,701 ---- channel_gui_unregister_one(channel, part); } ! #endif // FEAT_GUI static char *e_cannot_connect = N_("E902: Cannot connect to port"); *************** *** 3764,3796 **** 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. --- 3785,3790 ---- *** ../vim-8.1.1982/src/version.c 2019-09-04 18:15:16.178573707 +0200 --- src/version.c 2019-09-04 18:20:06.281158324 +0200 *************** *** 759,760 **** --- 759,762 ---- { /* Add new patch number below this line */ + /**/ + 1983, /**/ -- hundred-and-one symptoms of being an internet addict: 184. You no longer ask prospective dates what their sign is, instead your line is "Hi, what's your URL?" /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///