Patch 8.1.0989
Problem: Various small code ugliness.
Solution: Remove pointless NULL checks. Fix function calls. Fix typos.
(Dominique Pelle, closes #4060)
Files: src/buffer.c, src/crypt.c, src/evalfunc.c, src/ex_cmds2.c,
src/globals.h, src/gui_gtk_f.c, src/gui_gtk_x11.c, src/gui_mac.c,
src/ops.c, src/option.h, src/os_unix.c, src/os_win32.c,
src/popupmnu.c, src/regexp.c, src/ui.c, src/version.c
*** ../vim-8.1.0988/src/buffer.c 2019-02-16 19:05:07.352324625 +0100
--- src/buffer.c 2019-03-02 09:59:25.003064488 +0100
***************
*** 2163,2173 ****
clear_string_option(&buf->b_p_isk);
#ifdef FEAT_VARTABS
clear_string_option(&buf->b_p_vsts);
! if (buf->b_p_vsts_nopaste)
! vim_free(buf->b_p_vsts_nopaste);
buf->b_p_vsts_nopaste = NULL;
! if (buf->b_p_vsts_array)
! vim_free(buf->b_p_vsts_array);
buf->b_p_vsts_array = NULL;
clear_string_option(&buf->b_p_vts);
VIM_CLEAR(buf->b_p_vts_array);
--- 2163,2171 ----
clear_string_option(&buf->b_p_isk);
#ifdef FEAT_VARTABS
clear_string_option(&buf->b_p_vsts);
! vim_free(buf->b_p_vsts_nopaste);
buf->b_p_vsts_nopaste = NULL;
! vim_free(buf->b_p_vsts_array);
buf->b_p_vsts_array = NULL;
clear_string_option(&buf->b_p_vts);
VIM_CLEAR(buf->b_p_vts_array);
*** ../vim-8.1.0988/src/crypt.c 2019-01-19 17:43:03.401449251 +0100
--- src/crypt.c 2019-03-02 09:59:25.003064488 +0100
***************
*** 42,48 ****
/* Optional function pointer for a self-test. */
int (* self_test_fn)();
! /* Function pointer for initializing encryption/decription. */
void (* init_fn)(cryptstate_T *state, char_u *key,
char_u *salt, int salt_len, char_u *seed, int seed_len);
--- 42,48 ----
/* Optional function pointer for a self-test. */
int (* self_test_fn)();
! // Function pointer for initializing encryption/description.
void (* init_fn)(cryptstate_T *state, char_u *key,
char_u *salt, int salt_len, char_u *seed, int seed_len);
*** ../vim-8.1.0988/src/evalfunc.c 2019-02-26 17:03:49.841487966 +0100
--- src/evalfunc.c 2019-03-02 09:59:25.003064488 +0100
***************
*** 2451,2457 ****
utf8 = (int)tv_get_number_chk(&argvars[1], NULL);
if (utf8)
! rettv->vval.v_number = (*utf_ptr2char)(tv_get_string(&argvars[0]));
else
rettv->vval.v_number = (*mb_ptr2char)(tv_get_string(&argvars[0]));
}
--- 2451,2457 ----
utf8 = (int)tv_get_number_chk(&argvars[1], NULL);
if (utf8)
! rettv->vval.v_number = utf_ptr2char(tv_get_string(&argvars[0]));
else
rettv->vval.v_number = (*mb_ptr2char)(tv_get_string(&argvars[0]));
}
***************
*** 8701,8707 ****
if (argvars[1].v_type != VAR_UNKNOWN)
utf8 = (int)tv_get_number_chk(&argvars[1], NULL);
if (utf8)
! buf[(*utf_char2bytes)((int)tv_get_number(&argvars[0]), buf)] = NUL;
else
buf[(*mb_char2bytes)((int)tv_get_number(&argvars[0]), buf)] = NUL;
}
--- 8701,8707 ----
if (argvars[1].v_type != VAR_UNKNOWN)
utf8 = (int)tv_get_number_chk(&argvars[1], NULL);
if (utf8)
! buf[utf_char2bytes((int)tv_get_number(&argvars[0]), buf)] = NUL;
else
buf[(*mb_char2bytes)((int)tv_get_number(&argvars[0]), buf)] = NUL;
}
***************
*** 11647,11653 ****
rettv->vval.v_number = -1;
! // Sign identifer
sign_id = (int)tv_get_number_chk(&argvars[0], ¬anum);
if (notanum)
return;
--- 11647,11653 ----
rettv->vval.v_number = -1;
! // Sign identifier
sign_id = (int)tv_get_number_chk(&argvars[0], ¬anum);
if (notanum)
return;
***************
*** 11699,11705 ****
rettv->vval.v_number = -1;
! // Sign identifer
sign_id = (int)tv_get_number_chk(&argvars[0], ¬anum);
if (notanum)
return;
--- 11699,11705 ----
rettv->vval.v_number = -1;
! // Sign identifier
sign_id = (int)tv_get_number_chk(&argvars[0], ¬anum);
if (notanum)
return;
*** ../vim-8.1.0988/src/ex_cmds2.c 2019-02-17 17:44:36.203875545 +0100
--- src/ex_cmds2.c 2019-03-02 09:59:25.003064488 +0100
***************
*** 2380,2386 ****
goto_tabpage_win(tp, wp);
! /* Paranoia: did autocms wipe out the buffer with changes? */
if (!bufref_valid(&bufref))
goto theend;
goto buf_found;
--- 2380,2386 ----
goto_tabpage_win(tp, wp);
! // Paranoia: did autocmd wipe out the buffer with changes?
if (!bufref_valid(&bufref))
goto theend;
goto buf_found;
*** ../vim-8.1.0988/src/globals.h 2019-02-17 17:44:36.207875527 +0100
--- src/globals.h 2019-03-02 09:59:25.007064462 +0100
***************
*** 426,432 ****
# if defined(FEAT_MOUSE_DEC)
/*
* When the DEC mouse has been pressed but not yet released we enable
! * automatic querys for the mouse position.
*/
EXTERN int WantQueryMouse INIT(= FALSE);
# endif
--- 426,432 ----
# if defined(FEAT_MOUSE_DEC)
/*
* When the DEC mouse has been pressed but not yet released we enable
! * automatic queries for the mouse position.
*/
EXTERN int WantQueryMouse INIT(= FALSE);
# endif
*** ../vim-8.1.0988/src/gui_gtk_f.c 2019-02-17 17:44:36.207875527 +0100
--- src/gui_gtk_f.c 2019-03-02 09:59:25.007064462 +0100
***************
*** 561,567 ****
* gtk_widget_size_allocate() in advance with a well-posed
* allocation for a given child widget in order to set a
* certain private GtkWidget variable, called
! * widget->priv->alloc_need, to the proper value; othewise,
* gtk_widget_draw() fails and the relevant scrollbar won't
* appear on the screen.
*
--- 561,567 ----
* gtk_widget_size_allocate() in advance with a well-posed
* allocation for a given child widget in order to set a
* certain private GtkWidget variable, called
! * widget->priv->alloc_need, to the proper value; otherwise,
* gtk_widget_draw() fails and the relevant scrollbar won't
* appear on the screen.
*
*** ../vim-8.1.0988/src/gui_gtk_x11.c 2019-02-17 17:44:36.211875510 +0100
--- src/gui_gtk_x11.c 2019-03-02 09:59:25.007064462 +0100
***************
*** 7015,7021 ****
(double)(MIN(height, SIGN_HEIGHT))) < 1.15)
{
/* Change the aspect ratio by at most 15% to fill the
! * available space completly. */
height = (double)SIGN_HEIGHT * SIGN_ASPECT / aspect;
height = MIN(height, SIGN_HEIGHT);
}
--- 7015,7021 ----
(double)(MIN(height, SIGN_HEIGHT))) < 1.15)
{
/* Change the aspect ratio by at most 15% to fill the
! * available space completely. */
height = (double)SIGN_HEIGHT * SIGN_ASPECT / aspect;
height = MIN(height, SIGN_HEIGHT);
}
*** ../vim-8.1.0988/src/gui_mac.c 2019-01-24 15:04:44.674887811 +0100
--- src/gui_mac.c 2019-03-02 09:59:25.007064462 +0100
***************
*** 1342,1351 ****
}
error = AEInstallEventHandler('KAHL', 'MOD ',
NewAEEventHandlerUPP(Handle_KAHL_MOD_AE), 0, false);
- if (error)
- {
- return error;
- }
#endif
return error;
--- 1342,1347 ----
*** ../vim-8.1.0988/src/ops.c 2019-02-15 21:06:05.342289715 +0100
--- src/ops.c 2019-03-02 09:59:25.007064462 +0100
***************
*** 5402,5408 ****
linenr_T amount = Prenum1;
// do_addsub() might trigger re-evaluation of 'foldexpr' halfway, when the
! // buffer is not completly updated yet. Postpone updating folds until
before
// the call to changed_lines().
#ifdef FEAT_FOLDING
disable_fold_update++;
--- 5402,5408 ----
linenr_T amount = Prenum1;
// do_addsub() might trigger re-evaluation of 'foldexpr' halfway, when the
! // buffer is not completely updated yet. Postpone updating folds until
before
// the call to changed_lines().
#ifdef FEAT_FOLDING
disable_fold_update++;
*** ../vim-8.1.0988/src/option.h 2019-02-17 17:44:36.215875493 +0100
--- src/option.h 2019-03-02 09:59:25.007064462 +0100
***************
*** 193,200 ****
#define SHM_WRI 'w' /* "[w]" instead of "written" */
#define SHM_A "rmfixlnw" /* represented by 'a' flag */
#define SHM_WRITE 'W' /* don't use "written" at all */
! #define SHM_TRUNC 't' /* trunctate file messages */
! #define SHM_TRUNCALL 'T' /* trunctate all messages */
#define SHM_OVER 'o' /* overwrite file messages */
#define SHM_OVERALL 'O' /* overwrite more messages */
#define SHM_SEARCH 's' /* no search hit bottom messages */
--- 193,200 ----
#define SHM_WRI 'w' /* "[w]" instead of "written" */
#define SHM_A "rmfixlnw" /* represented by 'a' flag */
#define SHM_WRITE 'W' /* don't use "written" at all */
! #define SHM_TRUNC 't' /* truncate file messages */
! #define SHM_TRUNCALL 'T' /* truncate all messages */
#define SHM_OVER 'o' /* overwrite file messages */
#define SHM_OVERALL 'O' /* overwrite more messages */
#define SHM_SEARCH 's' /* no search hit bottom messages */
*** ../vim-8.1.0988/src/os_unix.c 2019-02-26 17:03:49.845487937 +0100
--- src/os_unix.c 2019-03-02 09:59:25.007064462 +0100
***************
*** 6418,6424 ****
int shell_style = STYLE_ECHO;
int check_spaces;
static int did_find_nul = FALSE;
! int ampersent = FALSE;
/* vimglob() function to define for Posix shell */
static char *sh_vimglob_func = "vimglob() { while [ $# -ge 1 ]; do echo
\"$1\"; shift; done }; vimglob >";
--- 6418,6424 ----
int shell_style = STYLE_ECHO;
int check_spaces;
static int did_find_nul = FALSE;
! int ampersand = FALSE;
/* vimglob() function to define for Posix shell */
static char *sh_vimglob_func = "vimglob() { while [ $# -ge 1 ]; do echo
\"$1\"; shift; done }; vimglob >";
***************
*** 6535,6541 ****
--p;
if (*p == '&') /* remove trailing '&' */
{
! ampersent = TRUE;
*p = ' ';
}
STRCAT(command, ">");
--- 6535,6541 ----
--p;
if (*p == '&') /* remove trailing '&' */
{
! ampersand = TRUE;
*p = ' ';
}
STRCAT(command, ">");
***************
*** 6604,6610 ****
}
if (flags & EW_SILENT)
show_shell_mess = FALSE;
! if (ampersent)
STRCAT(command, "&"); /* put the '&' after the redirection */
/*
--- 6604,6610 ----
}
if (flags & EW_SILENT)
show_shell_mess = FALSE;
! if (ampersand)
STRCAT(command, "&"); /* put the '&' after the redirection */
/*
***************
*** 6630,6636 ****
/* When running in the background, give it some time to create the temp
* file, but don't wait for it to finish. */
! if (ampersent)
mch_delay(10L, TRUE);
extra_shell_arg = NULL; /* cleanup */
--- 6630,6636 ----
/* When running in the background, give it some time to create the temp
* file, but don't wait for it to finish. */
! if (ampersand)
mch_delay(10L, TRUE);
extra_shell_arg = NULL; /* cleanup */
*** ../vim-8.1.0988/src/os_win32.c 2019-02-26 17:03:49.845487937 +0100
--- src/os_win32.c 2019-03-02 09:59:25.011064430 +0100
***************
*** 2646,2652 ****
if (cterm_normal_bg_color == 0)
cterm_normal_bg_color = ((g_attrCurrent >> 4) & 0xf) + 1;
! // Fg and Bg color index nunmber at startup
g_color_index_fg = g_attrDefault & 0xf;
g_color_index_bg = (g_attrDefault >> 4) & 0xf;
--- 2646,2652 ----
if (cterm_normal_bg_color == 0)
cterm_normal_bg_color = ((g_attrCurrent >> 4) & 0xf) + 1;
! // Fg and Bg color index number at startup
g_color_index_fg = g_attrDefault & 0xf;
g_color_index_bg = (g_attrDefault >> 4) & 0xf;
***************
*** 4210,4217 ****
(LPSTARTUPINFOW)si, /* Startup information */
pi); /* Process information */
vim_free(wcmd);
! if (wcwd != NULL)
! vim_free(wcwd);
return ret;
}
fallback:
--- 4210,4216 ----
(LPSTARTUPINFOW)si, /* Startup information */
pi); /* Process information */
vim_free(wcmd);
! vim_free(wcwd);
return ret;
}
fallback:
***************
*** 5312,5319 ****
*((WCHAR*)gap->ga_data + gap->ga_len++) = wval[n];
*((WCHAR*)gap->ga_data + gap->ga_len++) = L'\0';
}
! if (wkey != NULL) vim_free(wkey);
! if (wval != NULL) vim_free(wval);
}
}
}
--- 5311,5318 ----
*((WCHAR*)gap->ga_data + gap->ga_len++) = wval[n];
*((WCHAR*)gap->ga_data + gap->ga_len++) = L'\0';
}
! vim_free(wkey);
! vim_free(wval);
}
}
}
*** ../vim-8.1.0988/src/popupmnu.c 2019-01-30 21:40:58.943219829 +0100
--- src/popupmnu.c 2019-03-02 09:59:25.011064430 +0100
***************
*** 405,411 ****
char_u *p = NULL;
int totwidth, width, w;
int thumb_pos = 0;
! int thumb_heigth = 1;
int round;
int n;
--- 405,411 ----
char_u *p = NULL;
int totwidth, width, w;
int thumb_pos = 0;
! int thumb_height = 1;
int round;
int n;
***************
*** 423,432 ****
if (pum_scrollbar)
{
! thumb_heigth = pum_height * pum_height / pum_size;
! if (thumb_heigth == 0)
! thumb_heigth = 1;
! thumb_pos = (pum_first * (pum_height - thumb_heigth)
+ (pum_size - pum_height) / 2)
/ (pum_size - pum_height);
}
--- 423,432 ----
if (pum_scrollbar)
{
! thumb_height = pum_height * pum_height / pum_size;
! if (thumb_height == 0)
! thumb_height = 1;
! thumb_pos = (pum_first * (pum_height - thumb_height)
+ (pum_size - pum_height) / 2)
/ (pum_size - pum_height);
}
***************
*** 600,611 ****
#ifdef FEAT_RIGHTLEFT
if (curwin->w_p_rl)
screen_putchar(' ', row, pum_col - pum_width,
! i >= thumb_pos && i < thumb_pos + thumb_heigth
? attr_thumb : attr_scroll);
else
#endif
screen_putchar(' ', row, pum_col + pum_width,
! i >= thumb_pos && i < thumb_pos + thumb_heigth
? attr_thumb : attr_scroll);
}
--- 600,611 ----
#ifdef FEAT_RIGHTLEFT
if (curwin->w_p_rl)
screen_putchar(' ', row, pum_col - pum_width,
! i >= thumb_pos && i < thumb_pos + thumb_height
? attr_thumb : attr_scroll);
else
#endif
screen_putchar(' ', row, pum_col + pum_width,
! i >= thumb_pos && i < thumb_pos + thumb_height
? attr_thumb : attr_scroll);
}
*** ../vim-8.1.0988/src/regexp.c 2019-02-28 06:24:49.788775847 +0100
--- src/regexp.c 2019-03-02 09:59:25.011064430 +0100
***************
*** 6457,6463 ****
}
else if (op == RE_LNUM || op == RE_COL || op == RE_VCOL)
{
! /* one int plus comperator */
fprintf(f, " count %ld", OPERAND_MIN(s));
s += 5;
}
--- 6457,6463 ----
}
else if (op == RE_LNUM || op == RE_COL || op == RE_VCOL)
{
! /* one int plus comparator */
fprintf(f, " count %ld", OPERAND_MIN(s));
s += 5;
}
*** ../vim-8.1.0988/src/ui.c 2019-02-17 17:44:36.223875455 +0100
--- src/ui.c 2019-03-02 09:59:25.011064430 +0100
***************
*** 1738,1744 ****
if (!clip_did_set_selection)
{
/* Updating postponed, so that accessing the system clipboard won't
! * hang Vim when accessing it many times (e.g. on a :g comand). */
if ((cbd == &clip_plus && (clip_unnamed_saved & CLIP_UNNAMED_PLUS))
|| (cbd == &clip_star && (clip_unnamed_saved & CLIP_UNNAMED)))
{
--- 1738,1744 ----
if (!clip_did_set_selection)
{
/* Updating postponed, so that accessing the system clipboard won't
! * hang Vim when accessing it many times (e.g. on a :g command). */
if ((cbd == &clip_plus && (clip_unnamed_saved & CLIP_UNNAMED_PLUS))
|| (cbd == &clip_star && (clip_unnamed_saved & CLIP_UNNAMED)))
{
*** ../vim-8.1.0988/src/version.c 2019-03-02 07:57:12.236395037 +0100
--- src/version.c 2019-03-02 10:00:49.182459575 +0100
***************
*** 41,47 ****
{
/*
* Construct the long version string. Necessary because
! * VAX C can't catenate strings in the preprocessor.
*/
strcpy(longVersion, VIM_VERSION_LONG_DATE);
strcat(longVersion, __DATE__);
--- 41,47 ----
{
/*
* Construct the long version string. Necessary because
! * VAX C can't concatenate strings in the preprocessor.
*/
strcpy(longVersion, VIM_VERSION_LONG_DATE);
strcat(longVersion, __DATE__);
*** ../vim-8.1.0988/src/version.c 2019-03-02 07:57:12.236395037 +0100
--- src/version.c 2019-03-02 10:00:49.182459575 +0100
***************
*** 781,782 ****
--- 781,784 ----
{ /* Add new patch number below this line */
+ /**/
+ 989,
/**/
--
Due knot trussed yore spell chequer two fined awl miss steaks.
/// Bram Moolenaar -- [email protected] -- 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 ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.