Skip to content

Commit 113e107

Browse files
committed
patch 8.1.0785: depending on the configuration some functions are unused
Problem: Depending on the configuration some functions are unused. Solution: Add more #ifdefs, remove unused functions. (Dominique Pelle, closes #3822)
1 parent 1f20daa commit 113e107

28 files changed

Lines changed: 88 additions & 52 deletions

src/buffer.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5660,6 +5660,7 @@ bt_normal(buf_T *buf)
56605660
return buf != NULL && buf->b_p_bt[0] == NUL;
56615661
}
56625662

5663+
#if defined(FEAT_QUICKFIX) || defined(PROTO)
56635664
/*
56645665
* Return TRUE if "buf" is the quickfix buffer.
56655666
*/
@@ -5668,7 +5669,9 @@ bt_quickfix(buf_T *buf)
56685669
{
56695670
return buf != NULL && buf->b_p_bt[0] == 'q';
56705671
}
5672+
#endif
56715673

5674+
#if defined(FEAT_TERMINAL) || defined(PROTO)
56725675
/*
56735676
* Return TRUE if "buf" is a terminal buffer.
56745677
*/
@@ -5677,6 +5680,7 @@ bt_terminal(buf_T *buf)
56775680
{
56785681
return buf != NULL && buf->b_p_bt[0] == 't';
56795682
}
5683+
#endif
56805684

56815685
/*
56825686
* Return TRUE if "buf" is a help buffer.
@@ -5721,6 +5725,7 @@ bt_dontwrite(buf_T *buf)
57215725
|| buf->b_p_bt[0] == 'p');
57225726
}
57235727

5728+
#if defined(FEAT_QUICKFIX) || defined(PROTO)
57245729
int
57255730
bt_dontwrite_msg(buf_T *buf)
57265731
{
@@ -5731,6 +5736,7 @@ bt_dontwrite_msg(buf_T *buf)
57315736
}
57325737
return FALSE;
57335738
}
5739+
#endif
57345740

57355741
/*
57365742
* Return TRUE if the buffer should be hidden, according to 'hidden', ":hide"

src/channel.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2750,6 +2750,7 @@ may_invoke_callback(channel_T *channel, ch_part_T part)
27502750
return TRUE;
27512751
}
27522752

2753+
#if defined(FEAT_NETBEANS_INTG) || defined(PROTO)
27532754
/*
27542755
* Return TRUE when channel "channel" is open for writing to.
27552756
* Also returns FALSE or invalid "channel".
@@ -2760,6 +2761,7 @@ channel_can_write_to(channel_T *channel)
27602761
return channel != NULL && (channel->CH_SOCK_FD != INVALID_FD
27612762
|| channel->CH_IN_FD != INVALID_FD);
27622763
}
2764+
#endif
27632765

27642766
/*
27652767
* Return TRUE when channel "channel" is open for reading or writing.

src/ex_cmds2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1578,7 +1578,7 @@ timer_free_all()
15781578
# endif
15791579
# endif
15801580

1581-
#if defined(FEAT_SYN_HL) && defined(FEAT_RELTIME) && defined(FEAT_FLOAT)
1581+
#if defined(FEAT_SYN_HL) && defined(FEAT_RELTIME) && defined(FEAT_FLOAT) && defined(FEAT_PROFILE)
15821582
# if defined(HAVE_MATH_H)
15831583
# include <math.h>
15841584
# endif

src/ex_docmd.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12314,13 +12314,15 @@ get_messages_arg(expand_T *xp UNUSED, int idx)
1231412314
}
1231512315
#endif
1231612316

12317+
#if defined(FEAT_CMDL_COMPL) || defined(PROTO)
1231712318
char_u *
1231812319
get_mapclear_arg(expand_T *xp UNUSED, int idx)
1231912320
{
1232012321
if (idx == 0)
1232112322
return (char_u *)"<buffer>";
1232212323
return NULL;
1232312324
}
12325+
#endif
1232412326

1232512327
static int filetype_detect = FALSE;
1232612328
static int filetype_plugin = FALSE;

src/fileio.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9303,6 +9303,7 @@ has_cursormoved(void)
93039303
return (first_autopat[(int)EVENT_CURSORMOVED] != NULL);
93049304
}
93059305

9306+
#if defined(FEAT_CONCEAL) || defined(PROTO)
93069307
/*
93079308
* Return TRUE when there is a CursorMovedI autocommand defined.
93089309
*/
@@ -9311,6 +9312,7 @@ has_cursormovedI(void)
93119312
{
93129313
return (first_autopat[(int)EVENT_CURSORMOVEDI] != NULL);
93139314
}
9315+
#endif
93149316

93159317
/*
93169318
* Return TRUE when there is a TextChanged autocommand defined.
@@ -9330,6 +9332,7 @@ has_textchangedI(void)
93309332
return (first_autopat[(int)EVENT_TEXTCHANGEDI] != NULL);
93319333
}
93329334

9335+
#if defined(FEAT_INS_EXPAND) || defined(PROTO)
93339336
/*
93349337
* Return TRUE when there is a TextChangedP autocommand defined.
93359338
*/
@@ -9338,6 +9341,7 @@ has_textchangedP(void)
93389341
{
93399342
return (first_autopat[(int)EVENT_TEXTCHANGEDP] != NULL);
93409343
}
9344+
#endif
93419345

93429346
/*
93439347
* Return TRUE when there is an InsertCharPre autocommand defined.
@@ -9366,6 +9370,7 @@ has_funcundefined(void)
93669370
return (first_autopat[(int)EVENT_FUNCUNDEFINED] != NULL);
93679371
}
93689372

9373+
#if defined(FEAT_EVAL) || defined(PROTO)
93699374
/*
93709375
* Return TRUE when there is a TextYankPost autocommand defined.
93719376
*/
@@ -9374,6 +9379,7 @@ has_textyankpost(void)
93749379
{
93759380
return (first_autopat[(int)EVENT_TEXTYANKPOST] != NULL);
93769381
}
9382+
#endif
93779383

93789384
/*
93799385
* Execute autocommands for "event" and file name "fname".
@@ -9823,11 +9829,14 @@ unblock_autocmds(void)
98239829
# endif
98249830
}
98259831

9832+
#if defined(FEAT_EVAL) && (defined(FEAT_XIM) || defined(IME_WITHOUT_XIM)) \
9833+
|| defined(PROTO)
98269834
int
98279835
is_autocmd_blocked(void)
98289836
{
98299837
return autocmd_blocked != 0;
98309838
}
9839+
#endif
98319840

98329841
/*
98339842
* Find next autocommand pattern that matches.
@@ -10088,6 +10097,7 @@ get_event_name(expand_T *xp UNUSED, int idx)
1008810097

1008910098
#endif /* FEAT_CMDL_COMPL */
1009010099

10100+
#if defined(FEAT_EVAL) || defined(PROTO)
1009110101
/*
1009210102
* Return TRUE if autocmd is supported.
1009310103
*/
@@ -10196,6 +10206,7 @@ au_exists(char_u *arg)
1019610206
vim_free(arg_save);
1019710207
return retval;
1019810208
}
10209+
#endif
1019910210

1020010211

1020110212
/*

src/getchar.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ stuff_empty(void)
413413
&& readbuf2.bh_first.b_next == NULL);
414414
}
415415

416+
#if defined(FEAT_EVAL) || defined(PROTO)
416417
/*
417418
* Return TRUE if readbuf1 is empty. There may still be redo characters in
418419
* redbuf2.
@@ -422,6 +423,7 @@ readbuf1_empty(void)
422423
{
423424
return (readbuf1.bh_first.b_next == NULL);
424425
}
426+
#endif
425427

426428
/*
427429
* Set a typeahead character that won't be flushed.

src/gui_gtk_x11.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6737,11 +6737,13 @@ clip_mch_set_selection(VimClipboard *cbd UNUSED)
67376737
{
67386738
}
67396739

6740+
#if (defined(FEAT_XCLIPBOARD) && defined(USE_SYSTEM)) || defined(PROTO)
67406741
int
67416742
clip_gtk_owner_exists(VimClipboard *cbd)
67426743
{
67436744
return gdk_selection_owner_get(cbd->gtk_sel_atom) != NULL;
67446745
}
6746+
#endif
67456747

67466748

67476749
#if defined(FEAT_MENU) || defined(PROTO)

src/hashtab.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ hash_clear(hashtab_T *ht)
8181
vim_free(ht->ht_array);
8282
}
8383

84+
#if defined(FEAT_SPELL) || defined(PROTO)
8485
/*
8586
* Free the array of a hash table and all the keys it contains. The keys must
8687
* have been allocated. "off" is the offset from the start of the allocate
@@ -103,6 +104,7 @@ hash_clear_all(hashtab_T *ht, int off)
103104
}
104105
hash_clear(ht);
105106
}
107+
#endif
106108

107109
/*
108110
* Find "key" in hashtable "ht". "key" must not be NULL.
@@ -178,6 +180,7 @@ hash_lookup(hashtab_T *ht, char_u *key, hash_T hash)
178180
}
179181
}
180182

183+
#if defined(FEAT_EVAL) || defined(FEAT_SYN_HL) || defined(PROTO)
181184
/*
182185
* Print the efficiency of hashtable lookups.
183186
* Useful when trying different hash algorithms.
@@ -194,6 +197,7 @@ hash_debug_results(void)
194197
hash_count_perturb * 100 / hash_count_lookup);
195198
#endif
196199
}
200+
#endif
197201

198202
/*
199203
* Add item with key "key" to hashtable "ht".

src/json.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ json_encode(typval_T *val, int options)
5454
return ga.ga_data;
5555
}
5656

57+
#if defined(FEAT_JOB_CHANNEL) || defined(PROTO)
5758
/*
5859
* Encode ["nr", "val"] into a JSON format string in allocated memory.
5960
* "options" can contain JSON_JS, JSON_NO_NONE and JSON_NL.
@@ -83,6 +84,7 @@ json_encode_nr_expr(int nr, typval_T *val, int options)
8384
list_unref(listtv.vval.v_list);
8485
return ga.ga_data;
8586
}
87+
#endif
8688

8789
static void
8890
write_string(garray_T *gap, char_u *str)
@@ -1082,6 +1084,7 @@ json_decode_all(js_read_T *reader, typval_T *res, int options)
10821084
return OK;
10831085
}
10841086

1087+
#if defined(FEAT_JOB_CHANNEL) || defined(PROTO)
10851088
/*
10861089
* Decode the JSON from "reader" and store the result in "res".
10871090
* "options" can be JSON_JS or zero;
@@ -1102,6 +1105,7 @@ json_decode(js_read_T *reader, typval_T *res, int options)
11021105

11031106
return ret;
11041107
}
1108+
#endif
11051109

11061110
/*
11071111
* Decode the JSON from "reader" to find the end of the message.

src/mbyte.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,7 @@ bomb_size(void)
844844
return n;
845845
}
846846

847+
#if defined(FEAT_QUICKFIX) || defined(PROTO)
847848
/*
848849
* Remove all BOM from "s" by moving remaining text.
849850
*/
@@ -863,6 +864,7 @@ remove_bom(char_u *s)
863864
}
864865
}
865866
}
867+
#endif
866868

867869
/*
868870
* Get class of pointer:

0 commit comments

Comments
 (0)