To: vim_dev@googlegroups.com Subject: Patch 8.1.1745 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1745 Problem: Compiler warning for unused argument. Solution: Add UNUSED. Change comments to new style. Files: src/highlight.c *** ../vim-8.1.1744/src/highlight.c 2019-07-24 18:13:12.075723420 +0200 --- src/highlight.c 2019-07-24 18:57:44.670191808 +0200 *************** *** 157,163 **** NULL }; ! /* Default colors only used with a light background. */ static char *(highlight_init_light[]) = { CENT("Directory term=bold ctermfg=DarkBlue", "Directory term=bold ctermfg=DarkBlue guifg=Blue"), --- 157,163 ---- NULL }; ! // Default colors only used with a light background. static char *(highlight_init_light[]) = { CENT("Directory term=bold ctermfg=DarkBlue", "Directory term=bold ctermfg=DarkBlue guifg=Blue"), *************** *** 250,256 **** NULL }; ! /* Default colors only used with a dark background. */ static char *(highlight_init_dark[]) = { CENT("Directory term=bold ctermfg=LightCyan", "Directory term=bold ctermfg=LightCyan guifg=Cyan"), --- 250,256 ---- NULL }; ! // Default colors only used with a dark background. static char *(highlight_init_dark[]) = { CENT("Directory term=bold ctermfg=LightCyan", "Directory term=bold ctermfg=LightCyan guifg=Cyan"), *************** *** 3675,3681 **** int prio, int id, list_T *pos_list, ! char_u *conceal_char UNUSED) /* pointer to conceal replacement char */ { matchitem_T *cur; matchitem_T *prev; --- 3675,3681 ---- int prio, int id, list_T *pos_list, ! char_u *conceal_char UNUSED) // pointer to conceal replacement char { matchitem_T *cur; matchitem_T *prev; *************** *** 3715,3721 **** return -1; } ! /* Find available match ID. */ while (id == -1) { cur = wp->w_match_head; --- 3715,3721 ---- return -1; } ! // Find available match ID. while (id == -1) { cur = wp->w_match_head; *************** *** 3726,3732 **** wp->w_next_match_id++; } ! /* Build new match. */ m = ALLOC_CLEAR_ONE(matchitem_T); m->id = id; m->priority = prio; --- 3726,3732 ---- wp->w_next_match_id++; } ! // Build new match. m = ALLOC_CLEAR_ONE(matchitem_T); m->id = id; m->priority = prio; *************** *** 3741,3747 **** m->conceal_char = (*mb_ptr2char)(conceal_char); # endif ! /* Set up position matches */ if (pos_list != NULL) { linenr_T toplnum = 0; --- 3741,3747 ---- m->conceal_char = (*mb_ptr2char)(conceal_char); # endif ! // Set up position matches if (pos_list != NULL) { linenr_T toplnum = 0; *************** *** 3815,3821 **** botlnum = lnum + 1; } ! /* Calculate top and bottom lines for redrawing area */ if (toplnum != 0) { if (wp->w_buffer->b_mod_set) --- 3815,3821 ---- botlnum = lnum + 1; } ! // Calculate top and bottom lines for redrawing area if (toplnum != 0) { if (wp->w_buffer->b_mod_set) *************** *** 3838,3845 **** } } ! /* Insert new match. The match list is in ascending order with regard to ! * the match priorities. */ cur = wp->w_match_head; prev = cur; while (cur != NULL && prio >= cur->priority) --- 3838,3845 ---- } } ! // Insert new match. The match list is in ascending order with regard to ! // the match priorities. cur = wp->w_match_head; prev = cur; while (cur != NULL && prio >= cur->priority) *************** *** 3960,3967 **** { matchitem_T *cur; ! /* Setup for match and 'hlsearch' highlighting. Disable any previous ! * match */ cur = wp->w_match_head; while (cur != NULL) { --- 3960,3967 ---- { matchitem_T *cur; ! // Setup for match and 'hlsearch' highlighting. Disable any previous ! // match cur = wp->w_match_head; while (cur != NULL) { *************** *** 3974,3980 **** cur->hl.lnum = 0; cur->hl.first_lnum = 0; # ifdef FEAT_RELTIME ! /* Set the time limit to 'redrawtime'. */ profile_setlimit(p_rdt, &(cur->hl.tm)); # endif cur = cur->next; --- 3974,3980 ---- cur->hl.lnum = 0; cur->hl.first_lnum = 0; # ifdef FEAT_RELTIME ! // Set the time limit to 'redrawtime'. profile_setlimit(p_rdt, &(cur->hl.tm)); # endif cur = cur->next; *************** *** 3982,3988 **** search_hl->buf = wp->w_buffer; search_hl->lnum = 0; search_hl->first_lnum = 0; ! /* time limit is set at the toplevel, for all windows */ } /* --- 3982,3988 ---- search_hl->buf = wp->w_buffer; search_hl->lnum = 0; search_hl->first_lnum = 0; ! // time limit is set at the toplevel, for all windows } /* *************** *** 3991,4000 **** */ static int next_search_hl_pos( ! match_T *shl, /* points to a match */ linenr_T lnum, ! posmatch_T *posmatch, /* match positions */ ! colnr_T mincol) /* minimal column for a match */ { int i; int found = -1; --- 3991,4000 ---- */ static int next_search_hl_pos( ! match_T *shl, // points to a match linenr_T lnum, ! posmatch_T *posmatch, // match positions ! colnr_T mincol) // minimal column for a match { int i; int found = -1; *************** *** 4011,4018 **** { if (found >= 0) { ! /* if this match comes before the one at "found" then swap ! * them */ if (pos->col < posmatch->pos[found].col) { llpos_T tmp = *pos; --- 4011,4018 ---- { if (found >= 0) { ! // if this match comes before the one at "found" then swap ! // them if (pos->col < posmatch->pos[found].col) { llpos_T tmp = *pos; *************** *** 4076,4086 **** if (shl->lnum != 0) { ! /* Check for three situations: ! * 1. If the "lnum" is below a previous match, start a new search. ! * 2. If the previous match includes "mincol", use it. ! * 3. Continue after the previous match. ! */ l = shl->lnum + shl->rm.endpos[0].lnum - shl->rm.startpos[0].lnum; if (lnum > l) shl->lnum = 0; --- 4076,4085 ---- if (shl->lnum != 0) { ! // Check for three situations: ! // 1. If the "lnum" is below a previous match, start a new search. ! // 2. If the previous match includes "mincol", use it. ! // 3. Continue after the previous match. l = shl->lnum + shl->rm.endpos[0].lnum - shl->rm.startpos[0].lnum; if (lnum > l) shl->lnum = 0; *************** *** 4096,4114 **** for (;;) { # ifdef FEAT_RELTIME ! /* Stop searching after passing the time limit. */ if (profile_passed_limit(&(shl->tm))) { ! shl->lnum = 0; /* no match found in time */ break; } # endif ! /* Three situations: ! * 1. No useful previous match: search from start of line. ! * 2. Not Vi compatible or empty match: continue at next character. ! * Break the loop if this is beyond the end of the line. ! * 3. Vi compatible searching: continue at end of previous match. ! */ if (shl->lnum == 0) matchcol = 0; else if (vim_strchr(p_cpo, CPO_SEARCH) == NULL --- 4095,4112 ---- for (;;) { # ifdef FEAT_RELTIME ! // Stop searching after passing the time limit. if (profile_passed_limit(&(shl->tm))) { ! shl->lnum = 0; // no match found in time break; } # endif ! // Three situations: ! // 1. No useful previous match: search from start of line. ! // 2. Not Vi compatible or empty match: continue at next character. ! // Break the loop if this is beyond the end of the line. ! // 3. Vi compatible searching: continue at end of previous match. if (shl->lnum == 0) matchcol = 0; else if (vim_strchr(p_cpo, CPO_SEARCH) == NULL *************** *** 4136,4143 **** shl->lnum = lnum; if (shl->rm.regprog != NULL) { ! /* Remember whether shl->rm is using a copy of the regprog in ! * cur->match. */ int regprog_is_copy = (shl != search_hl && cur != NULL && shl == &cur->hl && cur->match.regprog == cur->hl.rm.regprog); --- 4134,4141 ---- shl->lnum = lnum; if (shl->rm.regprog != NULL) { ! // Remember whether shl->rm is using a copy of the regprog in ! // cur->match. int regprog_is_copy = (shl != search_hl && cur != NULL && shl == &cur->hl && cur->match.regprog == cur->hl.rm.regprog); *************** *** 4151,4173 **** NULL, NULL #endif ); ! /* Copy the regprog, in case it got freed and recompiled. */ if (regprog_is_copy) cur->match.regprog = cur->hl.rm.regprog; if (called_emsg || got_int || timed_out) { ! /* Error while handling regexp: stop using this regexp. */ if (shl == search_hl) { ! /* don't free regprog in the match list, it's a copy */ vim_regfree(shl->rm.regprog); set_no_hlsearch(TRUE); } shl->rm.regprog = NULL; shl->lnum = 0; ! got_int = FALSE; /* avoid the "Type :quit to exit Vim" ! message */ break; } } --- 4149,4170 ---- NULL, NULL #endif ); ! // Copy the regprog, in case it got freed and recompiled. if (regprog_is_copy) cur->match.regprog = cur->hl.rm.regprog; if (called_emsg || got_int || timed_out) { ! // Error while handling regexp: stop using this regexp. if (shl == search_hl) { ! // don't free regprog in the match list, it's a copy vim_regfree(shl->rm.regprog); set_no_hlsearch(TRUE); } shl->rm.regprog = NULL; shl->lnum = 0; ! got_int = FALSE; // avoid the "Type :quit to exit Vim" message break; } } *************** *** 4177,4183 **** nmatched = 0; if (nmatched == 0) { ! shl->lnum = 0; /* no match found */ break; } if (shl->rm.startpos[0].lnum > 0 --- 4174,4180 ---- nmatched = 0; if (nmatched == 0) { ! shl->lnum = 0; // no match found break; } if (shl->rm.startpos[0].lnum > 0 *************** *** 4186,4192 **** || shl->rm.endpos[0].col > mincol) { shl->lnum += shl->rm.startpos[0].lnum; ! break; /* useful match found */ } } --- 4183,4189 ---- || shl->rm.endpos[0].col > mincol) { shl->lnum += shl->rm.startpos[0].lnum; ! break; // useful match found } } *************** *** 4200,4218 **** void prepare_search_hl(win_T *wp, match_T *search_hl, linenr_T lnum) { ! matchitem_T *cur; /* points to the match list */ ! match_T *shl; /* points to search_hl or a match */ ! int shl_flag; /* flag to indicate whether search_hl ! has been processed or not */ ! int pos_inprogress; /* marks that position match search is ! in progress */ int n; ! /* ! * When using a multi-line pattern, start searching at the top ! * of the window or just after a closed fold. ! * Do this both for search_hl and the match list. ! */ cur = wp->w_match_head; shl_flag = WIN_IS_POPUP(wp); // skip search_hl in a popup window while (cur != NULL || shl_flag == FALSE) --- 4197,4213 ---- void prepare_search_hl(win_T *wp, match_T *search_hl, linenr_T lnum) { ! matchitem_T *cur; // points to the match list ! match_T *shl; // points to search_hl or a match ! int shl_flag; // flag to indicate whether search_hl ! // has been processed or not ! int pos_inprogress; // marks that position match search is ! // in progress int n; ! // When using a multi-line pattern, start searching at the top ! // of the window or just after a closed fold. ! // Do this both for search_hl and the match list. cur = wp->w_match_head; shl_flag = WIN_IS_POPUP(wp); // skip search_hl in a popup window while (cur != NULL || shl_flag == FALSE) *************** *** 4338,4344 **** else ++shl->endcol; } ! if ((long)shl->startcol < mincol) /* match at leftcol */ { shl->attr_cur = shl->attr; *search_attr = shl->attr; --- 4333,4339 ---- else ++shl->endcol; } ! if ((long)shl->startcol < mincol) // match at leftcol { shl->attr_cur = shl->attr; *search_attr = shl->attr; *************** *** 4366,4373 **** colnr_T col, char_u **line, match_T *search_hl, ! int *has_match_conc, ! int *match_conc, int did_line_attr, int lcs_eol_one) { --- 4361,4368 ---- colnr_T col, char_u **line, match_T *search_hl, ! int *has_match_conc UNUSED, ! int *match_conc UNUSED, int did_line_attr, int lcs_eol_one) { *************** *** 4444,4459 **** if (shl->startcol == shl->endcol) { ! /* highlight empty match, try again after ! * it */ if (has_mbyte) shl->endcol += (*mb_ptr2len)(*line + shl->endcol); else ++shl->endcol; } ! /* Loop to check if the match starts at the ! * current position */ continue; } } --- 4439,4454 ---- if (shl->startcol == shl->endcol) { ! // highlight empty match, try again after ! // it if (has_mbyte) shl->endcol += (*mb_ptr2len)(*line + shl->endcol); else ++shl->endcol; } ! // Loop to check if the match starts at the ! // current position continue; } } *************** *** 4484,4490 **** if (shl != search_hl && cur != NULL) cur = cur->next; } ! /* Only highlight one character after the last column. */ if (*(*line + col) == NUL && (did_line_attr >= 1 || (wp->w_p_list && lcs_eol_one == -1))) search_attr = 0; --- 4479,4485 ---- if (shl != search_hl && cur != NULL) cur = cur->next; } ! // Only highlight one character after the last column. if (*(*line + col) == NUL && (did_line_attr >= 1 || (wp->w_p_list && lcs_eol_one == -1))) search_attr = 0; *************** *** 4624,4630 **** return; if (cur->match.regprog == NULL) { ! /* match added with matchaddpos() */ for (i = 0; i < MAXPOSMATCH; ++i) { llpos_T *llpos; --- 4619,4625 ---- return; if (cur->match.regprog == NULL) { ! // match added with matchaddpos() for (i = 0; i < MAXPOSMATCH; ++i) { llpos_T *llpos; *************** *** 4693,4700 **** if ((l = argvars[0].vval.v_list) != NULL) { ! /* To some extent make sure that we are dealing with a list from ! * "getmatches()". */ li = l->lv_first; while (li != NULL) { --- 4688,4695 ---- if ((l = argvars[0].vval.v_list) != NULL) { ! // To some extent make sure that we are dealing with a list from ! // "getmatches()". li = l->lv_first; while (li != NULL) { *************** *** 4738,4744 **** return; } ! /* match from matchaddpos() */ for (i = 1; i < 9; i++) { sprintf((char *)buf, (char *)"pos%d", i); --- 4733,4739 ---- return; } ! // match from matchaddpos() for (i = 1; i < 9; i++) { sprintf((char *)buf, (char *)"pos%d", i); *************** *** 4791,4799 **** { # ifdef FEAT_SEARCH_EXTRA char_u buf[NUMBUFLEN]; ! char_u *grp = tv_get_string_buf_chk(&argvars[0], buf); /* group */ ! char_u *pat = tv_get_string_buf_chk(&argvars[1], buf); /* pattern */ ! int prio = 10; /* default priority */ int id = -1; int error = FALSE; char_u *conceal_char = NULL; --- 4786,4794 ---- { # ifdef FEAT_SEARCH_EXTRA char_u buf[NUMBUFLEN]; ! char_u *grp = tv_get_string_buf_chk(&argvars[0], buf); // group ! char_u *pat = tv_get_string_buf_chk(&argvars[1], buf); // pattern ! int prio = 10; // default priority int id = -1; int error = FALSE; char_u *conceal_char = NULL; *************** *** 4873,4879 **** if (error == TRUE) return; ! /* id == 3 is ok because matchaddpos() is supposed to substitute :3match */ if (id == 1 || id == 2) { semsg(_("E798: ID is reserved for \":match\": %d"), id); --- 4868,4874 ---- if (error == TRUE) return; ! // id == 3 is ok because matchaddpos() is supposed to substitute :3match if (id == 1 || id == 2) { semsg(_("E798: ID is reserved for \":match\": %d"), id); *************** *** 4956,4962 **** return; } ! /* First clear any old pattern. */ if (!eap->skip) match_delete(curwin, id, FALSE); --- 4951,4957 ---- return; } ! // First clear any old pattern. if (!eap->skip) match_delete(curwin, id, FALSE); *************** *** 4973,4979 **** p = skipwhite(p); if (*p == NUL) { ! /* There must be two arguments. */ vim_free(g); semsg(_(e_invarg2), eap->arg); return; --- 4968,4974 ---- p = skipwhite(p); if (*p == NUL) { ! // There must be two arguments. vim_free(g); semsg(_(e_invarg2), eap->arg); return; *** ../vim-8.1.1744/src/version.c 2019-07-24 18:43:04.416008732 +0200 --- src/version.c 2019-07-24 18:58:57.997769873 +0200 *************** *** 779,780 **** --- 779,782 ---- { /* Add new patch number below this line */ + /**/ + 1745, /**/ -- LARGE MAN: Who's that then? CART DRIVER: (Grudgingly) I dunno, Must be a king. LARGE MAN: Why? CART DRIVER: He hasn't got shit all over him. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// 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 ///