mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	vim-patch:8.1.1745: compiler warning for unused argument
Problem:    Compiler warning for unused argument.
Solution:   Add UNUSED.  Change comments to new style.
1f164b1968
			
			
This commit is contained in:
		| @@ -5648,8 +5648,11 @@ static void f_matchadd(typval_T *argvars, typval_T *rettv, FunPtr fptr) | |||||||
| { | { | ||||||
|   char grpbuf[NUMBUFLEN]; |   char grpbuf[NUMBUFLEN]; | ||||||
|   char patbuf[NUMBUFLEN]; |   char patbuf[NUMBUFLEN]; | ||||||
|  |   // group | ||||||
|   const char *const grp = tv_get_string_buf_chk(&argvars[0], grpbuf); |   const char *const grp = tv_get_string_buf_chk(&argvars[0], grpbuf); | ||||||
|  |   // pattern | ||||||
|   const char *const pat = tv_get_string_buf_chk(&argvars[1], patbuf); |   const char *const pat = tv_get_string_buf_chk(&argvars[1], patbuf); | ||||||
|  |   // default priority | ||||||
|   int prio = 10; |   int prio = 10; | ||||||
|   int id = -1; |   int id = -1; | ||||||
|   bool error = false; |   bool error = false; | ||||||
|   | |||||||
| @@ -3160,8 +3160,8 @@ win_line ( | |||||||
|                   shl->endcol += (*mb_ptr2len)(line + shl->endcol); |                   shl->endcol += (*mb_ptr2len)(line + shl->endcol); | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 /* Loop to check if the match starts at the |                 // Loop to check if the match starts at the | ||||||
|                  * current position */ |                 // current position | ||||||
|                 continue; |                 continue; | ||||||
|               } |               } | ||||||
|             } |             } | ||||||
| @@ -5732,12 +5732,11 @@ static void end_search_hl(void) | |||||||
|  * Init for calling prepare_search_hl(). |  * Init for calling prepare_search_hl(). | ||||||
|  */ |  */ | ||||||
| static void init_search_hl(win_T *wp) | static void init_search_hl(win_T *wp) | ||||||
|  |   FUNC_ATTR_NONNULL_ALL | ||||||
| { | { | ||||||
|   matchitem_T *cur; |   // Setup for match and 'hlsearch' highlighting.  Disable any previous | ||||||
|  |   // match | ||||||
|   /* Setup for match and 'hlsearch' highlighting.  Disable any previous |   matchitem_T *cur = wp->w_match_head; | ||||||
|    * match */ |  | ||||||
|   cur = wp->w_match_head; |  | ||||||
|   while (cur != NULL) { |   while (cur != NULL) { | ||||||
|     cur->hl.rm = cur->match; |     cur->hl.rm = cur->match; | ||||||
|     if (cur->hlg_id == 0) |     if (cur->hlg_id == 0) | ||||||
| @@ -5747,7 +5746,7 @@ static void init_search_hl(win_T *wp) | |||||||
|     cur->hl.buf = wp->w_buffer; |     cur->hl.buf = wp->w_buffer; | ||||||
|     cur->hl.lnum = 0; |     cur->hl.lnum = 0; | ||||||
|     cur->hl.first_lnum = 0; |     cur->hl.first_lnum = 0; | ||||||
|     /* Set the time limit to 'redrawtime'. */ |     // Set the time limit to 'redrawtime'. | ||||||
|     cur->hl.tm = profile_setlimit(p_rdt); |     cur->hl.tm = profile_setlimit(p_rdt); | ||||||
|     cur = cur->next; |     cur = cur->next; | ||||||
|   } |   } | ||||||
| @@ -5763,18 +5762,16 @@ static void init_search_hl(win_T *wp) | |||||||
|  * Advance to the match in window "wp" line "lnum" or past it. |  * Advance to the match in window "wp" line "lnum" or past it. | ||||||
|  */ |  */ | ||||||
| static void prepare_search_hl(win_T *wp, linenr_T lnum) | static void prepare_search_hl(win_T *wp, linenr_T lnum) | ||||||
|  |   FUNC_ATTR_NONNULL_ALL | ||||||
| { | { | ||||||
|   matchitem_T *cur;             /* points to the match list */ |   matchitem_T *cur;             // points to the match list | ||||||
|   match_T     *shl;             /* points to search_hl or a match */ |   match_T     *shl;             // points to search_hl or a match | ||||||
|   int shl_flag;                 /* flag to indicate whether search_hl |   bool shl_flag;                // flag to indicate whether search_hl | ||||||
|                                    has been processed or not */ |                                 // has been processed or not | ||||||
|   int n; |  | ||||||
|  |  | ||||||
|   /* |   // When using a multi-line pattern, start searching at the top | ||||||
|    * When using a multi-line pattern, start searching at the top |   // of the window or just after a closed fold. | ||||||
|    * of the window or just after a closed fold. |   // Do this both for search_hl and the match list. | ||||||
|    * Do this both for search_hl and the match list. |  | ||||||
|    */ |  | ||||||
|   cur = wp->w_match_head; |   cur = wp->w_match_head; | ||||||
|   shl_flag = false; |   shl_flag = false; | ||||||
|   while (cur != NULL || shl_flag == false) { |   while (cur != NULL || shl_flag == false) { | ||||||
| @@ -5801,7 +5798,7 @@ static void prepare_search_hl(win_T *wp, linenr_T lnum) | |||||||
|       } |       } | ||||||
|       bool pos_inprogress = true; // mark that a position match search is |       bool pos_inprogress = true; // mark that a position match search is | ||||||
|                                   // in progress |                                   // in progress | ||||||
|       n = 0; |       int n = 0; | ||||||
|       while (shl->first_lnum < lnum && (shl->rm.regprog != NULL |       while (shl->first_lnum < lnum && (shl->rm.regprog != NULL | ||||||
|                                         || (cur != NULL && pos_inprogress))) { |                                         || (cur != NULL && pos_inprogress))) { | ||||||
|         next_search_hl(wp, shl, shl->first_lnum, (colnr_T)n, |         next_search_hl(wp, shl, shl->first_lnum, (colnr_T)n, | ||||||
| @@ -5839,6 +5836,7 @@ next_search_hl ( | |||||||
|     colnr_T mincol,                /* minimal column for a match */ |     colnr_T mincol,                /* minimal column for a match */ | ||||||
|     matchitem_T *cur               /* to retrieve match positions if any */ |     matchitem_T *cur               /* to retrieve match positions if any */ | ||||||
| ) | ) | ||||||
|  |   FUNC_ATTR_NONNULL_ARG(2) | ||||||
| { | { | ||||||
|   linenr_T l; |   linenr_T l; | ||||||
|   colnr_T matchcol; |   colnr_T matchcol; | ||||||
| @@ -5846,11 +5844,10 @@ next_search_hl ( | |||||||
|   int save_called_emsg = called_emsg; |   int save_called_emsg = called_emsg; | ||||||
|  |  | ||||||
|   if (shl->lnum != 0) { |   if (shl->lnum != 0) { | ||||||
|     /* Check for three situations: |     // Check for three situations: | ||||||
|      * 1. If the "lnum" is below a previous match, start a new search. |     // 1. If the "lnum" is below a previous match, start a new search. | ||||||
|      * 2. If the previous match includes "mincol", use it. |     // 2. If the previous match includes "mincol", use it. | ||||||
|      * 3. Continue after the previous match. |     // 3. Continue after the previous match. | ||||||
|      */ |  | ||||||
|     l = shl->lnum + shl->rm.endpos[0].lnum - shl->rm.startpos[0].lnum; |     l = shl->lnum + shl->rm.endpos[0].lnum - shl->rm.startpos[0].lnum; | ||||||
|     if (lnum > l) |     if (lnum > l) | ||||||
|       shl->lnum = 0; |       shl->lnum = 0; | ||||||
| @@ -5864,22 +5861,21 @@ next_search_hl ( | |||||||
|    */ |    */ | ||||||
|   called_emsg = FALSE; |   called_emsg = FALSE; | ||||||
|   for (;; ) { |   for (;; ) { | ||||||
|     /* Stop searching after passing the time limit. */ |     // Stop searching after passing the time limit. | ||||||
|     if (profile_passed_limit(shl->tm)) { |     if (profile_passed_limit(shl->tm)) { | ||||||
|       shl->lnum = 0;                    /* no match found in time */ |       shl->lnum = 0;                    /* no match found in time */ | ||||||
|       break; |       break; | ||||||
|     } |     } | ||||||
|     /* Three situations: |     // Three situations: | ||||||
|      * 1. No useful previous match: search from start of line. |     // 1. No useful previous match: search from start of line. | ||||||
|      * 2. Not Vi compatible or empty match: continue at next character. |     // 2. Not Vi compatible or empty match: continue at next character. | ||||||
|      *    Break the loop if this is beyond the end of the line. |     //    Break the loop if this is beyond the end of the line. | ||||||
|      * 3. Vi compatible searching: continue at end of previous match. |     // 3. Vi compatible searching: continue at end of previous match. | ||||||
|      */ |     if (shl->lnum == 0) { | ||||||
|     if (shl->lnum == 0) |  | ||||||
|       matchcol = 0; |       matchcol = 0; | ||||||
|     else if (vim_strchr(p_cpo, CPO_SEARCH) == NULL |     } else if (vim_strchr(p_cpo, CPO_SEARCH) == NULL | ||||||
|         || (shl->rm.endpos[0].lnum == 0 |                || (shl->rm.endpos[0].lnum == 0 | ||||||
|           && shl->rm.endpos[0].col <= shl->rm.startpos[0].col)) { |                    && shl->rm.endpos[0].col <= shl->rm.startpos[0].col)) { | ||||||
|       char_u      *ml; |       char_u      *ml; | ||||||
|  |  | ||||||
|       matchcol = shl->rm.startpos[0].col; |       matchcol = shl->rm.startpos[0].col; | ||||||
| @@ -5896,8 +5892,8 @@ next_search_hl ( | |||||||
|  |  | ||||||
|     shl->lnum = lnum; |     shl->lnum = lnum; | ||||||
|     if (shl->rm.regprog != NULL) { |     if (shl->rm.regprog != NULL) { | ||||||
|       /* Remember whether shl->rm is using a copy of the regprog in |       // Remember whether shl->rm is using a copy of the regprog in | ||||||
|        * cur->match. */ |       // cur->match. | ||||||
|       bool regprog_is_copy = (shl != &search_hl |       bool regprog_is_copy = (shl != &search_hl | ||||||
|                               && cur != NULL |                               && cur != NULL | ||||||
|                               && shl == &cur->hl |                               && shl == &cur->hl | ||||||
| @@ -5926,7 +5922,7 @@ next_search_hl ( | |||||||
|       nmatched = next_search_hl_pos(shl, lnum, &(cur->pos), matchcol); |       nmatched = next_search_hl_pos(shl, lnum, &(cur->pos), matchcol); | ||||||
|     } |     } | ||||||
|     if (nmatched == 0) { |     if (nmatched == 0) { | ||||||
|       shl->lnum = 0;                    /* no match found */ |       shl->lnum = 0;                    // no match found | ||||||
|       break; |       break; | ||||||
|     } |     } | ||||||
|     if (shl->rm.startpos[0].lnum > 0 |     if (shl->rm.startpos[0].lnum > 0 | ||||||
| @@ -5934,7 +5930,7 @@ next_search_hl ( | |||||||
|         || nmatched > 1 |         || nmatched > 1 | ||||||
|         || shl->rm.endpos[0].col > mincol) { |         || shl->rm.endpos[0].col > mincol) { | ||||||
|       shl->lnum += shl->rm.startpos[0].lnum; |       shl->lnum += shl->rm.startpos[0].lnum; | ||||||
|       break;                            /* useful match found */ |       break;                            // useful match found | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     // Restore called_emsg for assert_fails(). |     // Restore called_emsg for assert_fails(). | ||||||
| @@ -5951,6 +5947,7 @@ next_search_hl_pos( | |||||||
|     posmatch_T *posmatch, // match positions |     posmatch_T *posmatch, // match positions | ||||||
|     colnr_T mincol        // minimal column for a match |     colnr_T mincol        // minimal column for a match | ||||||
| ) | ) | ||||||
|  |   FUNC_ATTR_NONNULL_ALL | ||||||
| { | { | ||||||
|   int i; |   int i; | ||||||
|   int found = -1; |   int found = -1; | ||||||
|   | |||||||
| @@ -6544,10 +6544,12 @@ void restore_buffer(bufref_T *save_curbuf) | |||||||
| /// @param[in] id a desired ID 'id' can be specified | /// @param[in] id a desired ID 'id' can be specified | ||||||
| ///               (greater than or equal to 1). -1 must be specified if no | ///               (greater than or equal to 1). -1 must be specified if no | ||||||
| ///               particular ID is desired | ///               particular ID is desired | ||||||
|  | /// @param[in] conceal_char pointer to conceal replacement char | ||||||
| /// @return ID of added match, -1 on failure. | /// @return ID of added match, -1 on failure. | ||||||
| int match_add(win_T *wp, const char *const grp, const char *const pat, | int match_add(win_T *wp, const char *const grp, const char *const pat, | ||||||
|               int prio, int id, list_T *pos_list, |               int prio, int id, list_T *pos_list, | ||||||
|               const char *const conceal_char) |               const char *const conceal_char) | ||||||
|  |   FUNC_ATTR_NONNULL_ARG(1, 2) | ||||||
| { | { | ||||||
|   matchitem_T *cur; |   matchitem_T *cur; | ||||||
|   matchitem_T *prev; |   matchitem_T *prev; | ||||||
| @@ -6584,7 +6586,7 @@ int match_add(win_T *wp, const char *const grp, const char *const pat, | |||||||
|     return -1; |     return -1; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* Find available match ID. */ |   // Find available match ID. | ||||||
|   while (id == -1) { |   while (id == -1) { | ||||||
|     cur = wp->w_match_head; |     cur = wp->w_match_head; | ||||||
|     while (cur != NULL && cur->id != wp->w_next_match_id) |     while (cur != NULL && cur->id != wp->w_next_match_id) | ||||||
| @@ -6594,7 +6596,7 @@ int match_add(win_T *wp, const char *const grp, const char *const pat, | |||||||
|     wp->w_next_match_id++; |     wp->w_next_match_id++; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* Build new match. */ |   // Build new match. | ||||||
|   m = xcalloc(1, sizeof(matchitem_T)); |   m = xcalloc(1, sizeof(matchitem_T)); | ||||||
|   m->id = id; |   m->id = id; | ||||||
|   m->priority = prio; |   m->priority = prio; | ||||||
| @@ -6702,9 +6704,9 @@ int match_add(win_T *wp, const char *const grp, const char *const pat, | |||||||
|       rtype = VALID; |       rtype = VALID; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   |  | ||||||
|   /* Insert new match.  The match list is in ascending order with regard to |   // Insert new match.  The match list is in ascending order with regard to | ||||||
|    * the match priorities. */ |   // the match priorities. | ||||||
|   cur = wp->w_match_head; |   cur = wp->w_match_head; | ||||||
|   prev = cur; |   prev = cur; | ||||||
|   while (cur != NULL && prio >= cur->priority) { |   while (cur != NULL && prio >= cur->priority) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jan Edmund Lazo
					Jan Edmund Lazo