Skip to content

Commit c71982b

Browse files
committed
patch 7.4.1050
Problem: Warning for unused var with tiny features. (Tony Mechelynck) Solution: Add #ifdef. Use vim_snprintf(). Reduce number of statemements.
1 parent 485dace commit c71982b

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

src/ops.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6974,7 +6974,9 @@ cursor_pos_info(dict)
69746974
char_u buf2[40];
69756975
linenr_T lnum;
69766976
long byte_count = 0;
6977+
#ifdef FEAT_MBYTE
69776978
long bom_count = 0;
6979+
#endif
69786980
long byte_count_cursor = 0;
69796981
long char_count = 0;
69806982
long char_count_cursor = 0;
@@ -7190,15 +7192,15 @@ cursor_pos_info(dict)
71907192
}
71917193
}
71927194

7193-
/* Don't shorten this message, the user asked for it. */
71947195
#ifdef FEAT_MBYTE
71957196
bom_count = bomb_size();
71967197
if (bom_count > 0)
7197-
sprintf((char *)IObuff + STRLEN(IObuff), _("(+%ld for BOM)"),
7198-
bom_count);
7198+
vim_snprintf((char *)IObuff + STRLEN(IObuff), IOSIZE,
7199+
_("(+%ld for BOM)"), bom_count);
71997200
#endif
72007201
if (dict == NULL)
72017202
{
7203+
/* Don't shorten this message, the user asked for it. */
72027204
p = p_shm;
72037205
p_shm = (char_u *)"";
72047206
msg(IObuff);
@@ -7210,19 +7212,17 @@ cursor_pos_info(dict)
72107212
{
72117213
dict_add_nr_str(dict, "words", (long)word_count, NULL);
72127214
dict_add_nr_str(dict, "chars", (long)char_count, NULL);
7213-
dict_add_nr_str(dict, "bytes", (long)byte_count + bom_count, NULL);
7214-
if (VIsual_active)
7215-
{
7216-
dict_add_nr_str(dict, "visual_bytes", (long)byte_count_cursor, NULL);
7217-
dict_add_nr_str(dict, "visual_chars", (long)char_count_cursor, NULL);
7218-
dict_add_nr_str(dict, "visual_words", (long)word_count_cursor, NULL);
7219-
}
7220-
else
7221-
{
7222-
dict_add_nr_str(dict, "cursor_bytes", (long)byte_count_cursor, NULL);
7223-
dict_add_nr_str(dict, "cursor_chars", (long)char_count_cursor, NULL);
7224-
dict_add_nr_str(dict, "cursor_words", (long)word_count_cursor, NULL);
7225-
}
7215+
dict_add_nr_str(dict, "bytes", (long)byte_count
7216+
# ifdef FEAT_MBYTE
7217+
+ bom_count
7218+
# endif
7219+
, NULL);
7220+
dict_add_nr_str(dict, VIsual_active ? "visual_bytes" : "cursor_bytes",
7221+
(long)byte_count_cursor, NULL);
7222+
dict_add_nr_str(dict, VIsual_active ? "visual_chars" : "cursor_chars",
7223+
(long)char_count_cursor, NULL);
7224+
dict_add_nr_str(dict, VIsual_active ? "visual_words" : "cursor_words",
7225+
(long)word_count_cursor, NULL);
72267226
}
72277227
#endif
72287228
}

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,8 @@ static char *(features[]) =
741741

742742
static int included_patches[] =
743743
{ /* Add new patch number below this line */
744+
/**/
745+
1050,
744746
/**/
745747
1049,
746748
/**/

0 commit comments

Comments
 (0)