Patch 8.2.3460

8 views
Skip to first unread message

Bram Moolenaar

unread,
Oct 2, 2021, 6:27:44 AM10/2/21
to vim...@googlegroups.com

Patch 8.2.3460
Problem: Some type casts are not needed.
Solution: Remove unnecessary type casts. (closes #8934)
Files: src/autocmd.c, src/buffer.c, src/debugger.c, src/getchar.c,
src/hardcopy.c, src/if_cscope.c, src/move.c, src/tag.c,
src/version.c


*** ../vim-8.2.3459/src/autocmd.c 2021-09-12 12:39:04.319467418 +0100
--- src/autocmd.c 2021-10-02 11:19:10.587618255 +0100
***************
*** 386,392 ****
return;

// loop over all events
! for (event = (event_T)0; (int)event < (int)NUM_EVENTS;
event = (event_T)((int)event + 1))
{
// loop over all autocommand patterns
--- 386,392 ----
return;

// loop over all events
! for (event = (event_T)0; (int)event < NUM_EVENTS;
event = (event_T)((int)event + 1))
{
// loop over all autocommand patterns
***************
*** 460,466 ****
apc->arg_bufnr = 0;

// invalidate buflocals looping through events
! for (event = (event_T)0; (int)event < (int)NUM_EVENTS;
event = (event_T)((int)event + 1))
// loop over all autocommand patterns
FOR_ALL_AUTOCMD_PATTERNS(event, ap)
--- 460,466 ----
apc->arg_bufnr = 0;

// invalidate buflocals looping through events
! for (event = (event_T)0; (int)event < NUM_EVENTS;
event = (event_T)((int)event + 1))
// loop over all autocommand patterns
FOR_ALL_AUTOCMD_PATTERNS(event, ap)
***************
*** 523,529 ****
AutoPat *ap;
int in_use = FALSE;

! for (event = (event_T)0; (int)event < (int)NUM_EVENTS;
event = (event_T)((int)event + 1))
{
FOR_ALL_AUTOCMD_PATTERNS(event, ap)
--- 523,529 ----
AutoPat *ap;
int in_use = FALSE;

! for (event = (event_T)0; (int)event < NUM_EVENTS;
event = (event_T)((int)event + 1))
{
FOR_ALL_AUTOCMD_PATTERNS(event, ap)
***************
*** 695,701 ****
{
for (pat = arg; *pat && *pat != '|' && !VIM_ISWHITE(*pat); pat = p)
{
! if ((int)event_name2nr(pat, &p) >= (int)NUM_EVENTS)
{
if (have_group)
semsg(_("E216: No such event: %s"), pat);
--- 695,701 ----
{
for (pat = arg; *pat && *pat != '|' && !VIM_ISWHITE(*pat); pat = p)
{
! if ((int)event_name2nr(pat, &p) >= NUM_EVENTS)
{
if (have_group)
semsg(_("E216: No such event: %s"), pat);
***************
*** 967,973 ****
if (!forceit && *cmd != NUL)
emsg(_(e_cannot_define_autocommands_for_all_events));
else
! for (event = (event_T)0; (int)event < (int)NUM_EVENTS;
event = (event_T)((int)event + 1))
if (do_autocmd_event(event, pat,
once, nested, cmd, forceit, group, flags) == FAIL)
--- 967,973 ----
if (!forceit && *cmd != NUL)
emsg(_(e_cannot_define_autocommands_for_all_events));
else
! for (event = (event_T)0; (int)event < NUM_EVENTS;
event = (event_T)((int)event + 1))
if (do_autocmd_event(event, pat,
once, nested, cmd, forceit, group, flags) == FAIL)
*** ../vim-8.2.3459/src/buffer.c 2021-08-28 19:42:43.636422753 +0100
--- src/buffer.c 2021-10-02 11:19:10.591618304 +0100
***************
*** 103,109 ****
retval = readfile(
read_stdin ? NULL : curbuf->b_ffname,
read_stdin ? NULL : curbuf->b_fname,
! (linenr_T)line_count, (linenr_T)0, (linenr_T)MAXLNUM, eap,
flags | READ_BUFFER);
if (retval == OK)
{
--- 103,109 ----
retval = readfile(
read_stdin ? NULL : curbuf->b_ffname,
read_stdin ? NULL : curbuf->b_fname,
! line_count, (linenr_T)0, (linenr_T)MAXLNUM, eap,
flags | READ_BUFFER);
if (retval == OK)
{
*** ../vim-8.2.3459/src/debugger.c 2021-09-09 11:34:15.657539707 +0100
--- src/debugger.c 2021-10-02 11:19:10.591618304 +0100
***************
*** 440,446 ****
// replace K_SNR with "<SNR>"
if (debug_breakpoint_name[0] == K_SPECIAL
&& debug_breakpoint_name[1] == KS_EXTRA
! && debug_breakpoint_name[2] == (int)KE_SNR)
p = (char_u *)"<SNR>";
else
p = (char_u *)"";
--- 440,446 ----
// replace K_SNR with "<SNR>"
if (debug_breakpoint_name[0] == K_SPECIAL
&& debug_breakpoint_name[1] == KS_EXTRA
! && debug_breakpoint_name[2] == KE_SNR)
p = (char_u *)"<SNR>";
else
p = (char_u *)"";
*** ../vim-8.2.3459/src/getchar.c 2021-08-09 18:59:01.442811242 +0100
--- src/getchar.c 2021-10-02 11:19:10.591618304 +0100
***************
*** 1853,1859 ****
// or a K_SPECIAL - KS_EXTRA - KE_CSI, which is CSI
// too.
c = vgetorpeek(TRUE);
! if (vgetorpeek(TRUE) == (int)KE_CSI && c == KS_EXTRA)
buf[i] = CSI;
}
}
--- 1853,1859 ----
// or a K_SPECIAL - KS_EXTRA - KE_CSI, which is CSI
// too.
c = vgetorpeek(TRUE);
! if (vgetorpeek(TRUE) == KE_CSI && c == KS_EXTRA)
buf[i] = CSI;
}
}
***************
*** 2521,2527 ****
if (*s == RM_SCRIPT
&& (mp->m_keys[0] != K_SPECIAL
|| mp->m_keys[1] != KS_EXTRA
! || mp->m_keys[2] != (int)KE_SNR))
continue;

// If one of the typed keys cannot be remapped, skip the
--- 2521,2527 ----
if (*s == RM_SCRIPT
&& (mp->m_keys[0] != K_SPECIAL
|| mp->m_keys[1] != KS_EXTRA
! || mp->m_keys[2] != KE_SNR))
continue;

// If one of the typed keys cannot be remapped, skip the
***************
*** 3139,3145 ****
if (!VIM_ISWHITE(ptr[col]))
curwin->w_wcol = vcol;
vcol += lbr_chartabsize(ptr, ptr + col,
! (colnr_T)vcol);
if (has_mbyte)
col += (*mb_ptr2len)(ptr + col);
else
--- 3139,3145 ----
if (!VIM_ISWHITE(ptr[col]))
curwin->w_wcol = vcol;
vcol += lbr_chartabsize(ptr, ptr + col,
! vcol);
if (has_mbyte)
col += (*mb_ptr2len)(ptr + col);
else
*** ../vim-8.2.3459/src/hardcopy.c 2021-06-02 12:28:11.431120460 +0100
--- src/hardcopy.c 2021-10-02 11:19:10.591618304 +0100
***************
*** 588,594 ****
*/
if (mch_print_init(&settings,
curbuf->b_fname == NULL
! ? (char_u *)buf_spname(curbuf)
: curbuf->b_sfname == NULL
? curbuf->b_fname
: curbuf->b_sfname,
--- 588,594 ----
*/
if (mch_print_init(&settings,
curbuf->b_fname == NULL
! ? buf_spname(curbuf)
: curbuf->b_sfname == NULL
? curbuf->b_fname
: curbuf->b_sfname,
***************
*** 1931,1937 ****
break;

case PRT_DSC_ENDCOMMENTS_TYPE:
! // Wont find title or resource after this comment, stop searching
seen_all = TRUE;
break;

--- 1931,1937 ----
break;

case PRT_DSC_ENDCOMMENTS_TYPE:
! // Won't find title or resource after this comment, stop searching
seen_all = TRUE;
break;

*** ../vim-8.2.3459/src/if_cscope.c 2021-07-24 15:16:11.542239515 +0100
--- src/if_cscope.c 2021-10-02 11:19:10.591618304 +0100
***************
*** 1253,1259 ****
int matched = 0;

// read output
! cs_fill_results((char *)pat, totmatches, nummatches, &matches,
&contexts, &matched);
vim_free(nummatches);
if (matches == NULL)
--- 1253,1259 ----
int matched = 0;

// read output
! cs_fill_results(pat, totmatches, nummatches, &matches,
&contexts, &matched);
vim_free(nummatches);
if (matches == NULL)
***************
*** 1745,1751 ****
*
* <filename> <context> <line number> <pattern>
*/
! if ((name = strtok((char *)buf, (const char *)" ")) == NULL)
return NULL;
if ((*context = strtok(NULL, (const char *)" ")) == NULL)
return NULL;
--- 1745,1751 ----
*
* <filename> <context> <line number> <pattern>
*/
! if ((name = strtok(buf, (const char *)" ")) == NULL)
return NULL;
if ((*context = strtok(NULL, (const char *)" ")) == NULL)
return NULL;
*** ../vim-8.2.3459/src/move.c 2021-09-01 15:01:29.601137676 +0100
--- src/move.c 2021-10-02 11:19:10.591618304 +0100
***************
*** 1028,1034 ****
// column
sbr = get_showbreak_value(curwin);
if (*sbr && *ml_get_cursor() == NUL
! && curwin->w_wcol == (int)vim_strsize(sbr))
curwin->w_wcol = 0;
#endif
}
--- 1028,1034 ----
// column
sbr = get_showbreak_value(curwin);
if (*sbr && *ml_get_cursor() == NUL
! && curwin->w_wcol == vim_strsize(sbr))
curwin->w_wcol = 0;
#endif
}
*** ../vim-8.2.3459/src/tag.c 2021-08-21 15:21:14.662455461 +0100
--- src/tag.c 2021-10-02 11:19:10.591618304 +0100
***************
*** 2802,2808 ****
if (*p == TAG_SEP)
*p = NUL;
}
! matches[match_count++] = (char_u *)mfp;
}
}

--- 2802,2808 ----
if (*p == TAG_SEP)
*p = NUL;
}
! matches[match_count++] = mfp;
}
}

*** ../vim-8.2.3459/src/version.c 2021-09-30 18:59:55.938522918 +0100
--- src/version.c 2021-10-02 11:19:10.591618304 +0100
***************
*** 7746,7752 ****
static void
version_msg_wrap(char_u *s, int wrap)
{
! int len = (int)vim_strsize(s) + (wrap ? 2 : 0);

if (!got_int && len < (int)Columns && msg_col + len >= (int)Columns
&& *s != '\n')
--- 7746,7752 ----
static void
version_msg_wrap(char_u *s, int wrap)
{
! int len = vim_strsize(s) + (wrap ? 2 : 0);

if (!got_int && len < (int)Columns && msg_col + len >= (int)Columns
&& *s != '\n')
***************
*** 7798,7804 ****
// width.
for (i = 0; size < 0 ? items[i] != NULL : i < size; ++i)
{
! int l = (int)vim_strsize(items[i]) + (i == current ? 2 : 0);

if (l > width)
width = l;
--- 7798,7804 ----
// width.
for (i = 0; size < 0 ? items[i] != NULL : i < size; ++i)
{
! int l = vim_strsize(items[i]) + (i == current ? 2 : 0);

if (l > width)
width = l;
*** ../vim-8.2.3459/src/version.c 2021-09-26 21:55:57.720529413 +0100
--- src/version.c 2021-09-30 18:49:42.606819721 +0100
***************
*** 759,760 ****
--- 759,762 ----
{ /* Add new patch number below this line */
+ /**/
+ 3460,
/**/

--
From "know your smileys":
<<<:-{ Worf (Never smiles anyways, so he's a bad smiley)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages