Skip to content

Commit

Permalink
patch 8.2.3320: some local functions are not static
Browse files Browse the repository at this point in the history
Problem:    Some local functions are not static.
Solution:   Add "static".  Move snprintf() related code to strings.c.
            (Yegappan Lakshmanan, closes #8734)
  • Loading branch information
yegappan authored and brammool committed Aug 9, 2021
1 parent eed9616 commit 8ee52af
Show file tree
Hide file tree
Showing 31 changed files with 1,303 additions and 1,327 deletions.
24 changes: 9 additions & 15 deletions src/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,19 +232,15 @@ lalloc(size_t size, int message)
mem_pre_alloc_l(&size);
#endif

/*
* Loop when out of memory: Try to release some memfile blocks and
* if some blocks are released call malloc again.
*/
// Loop when out of memory: Try to release some memfile blocks and
// if some blocks are released call malloc again.
for (;;)
{
/*
* Handle three kind of systems:
* 1. No check for available memory: Just return.
* 2. Slow check for available memory: call mch_avail_mem() after
* allocating KEEP_ROOM amount of memory.
* 3. Strict check for available memory: call mch_avail_mem()
*/
// Handle three kind of systems:
// 1. No check for available memory: Just return.
// 2. Slow check for available memory: call mch_avail_mem() after
// allocating KEEP_ROOM amount of memory.
// 3. Strict check for available memory: call mch_avail_mem()
if ((p = malloc(size)) != NULL)
{
#ifndef HAVE_AVAIL_MEM
Expand All @@ -268,10 +264,8 @@ lalloc(size_t size, int message)
goto theend;
#endif
}
/*
* Remember that mf_release_all() is being called to avoid an endless
* loop, because mf_release_all() may call alloc() recursively.
*/
// Remember that mf_release_all() is being called to avoid an endless
// loop, because mf_release_all() may call alloc() recursively.
if (releasing)
break;
releasing = TRUE;
Expand Down
2 changes: 1 addition & 1 deletion src/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -3025,7 +3025,7 @@ channel_has_readahead(channel_T *channel, ch_part_T part)
* Return a string indicating the status of the channel.
* If "req_part" is not negative check that part.
*/
char *
static char *
channel_status(channel_T *channel, int req_part)
{
ch_part_T part;
Expand Down
2 changes: 1 addition & 1 deletion src/dict.c
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ dict2string(typval_T *tv, int copyID, int restore_copyID)
* Advance over a literal key, including "-". If the first character is not a
* literal key character then "key" is returned.
*/
char_u *
static char_u *
skip_literal_key(char_u *key)
{
char_u *p;
Expand Down
4 changes: 2 additions & 2 deletions src/digraph.c
Original file line number Diff line number Diff line change
Expand Up @@ -2029,7 +2029,7 @@ registerdigraph(int char1, int char2, int n)
* If they are valid, returns TRUE; otherwise, give an error message and
* returns FALSE.
*/
int
static int
check_digraph_chars_valid(int char1, int char2)
{
if (char2 == 0)
Expand Down Expand Up @@ -2193,7 +2193,7 @@ digraph_getlist_appendpair(digr_T *dp, list_T *l)
li2->li_tv.vval.v_string = vim_strsave(buf);
}

void
static void
digraph_getlist_common(int list_all, typval_T *rettv)
{
int i;
Expand Down
2 changes: 1 addition & 1 deletion src/edit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1587,7 +1587,7 @@ ins_ctrl_v(void)
* Note that this doesn't wait for characters, they must be in the typeahead
* buffer already.
*/
int
static int
decodeModifyOtherKeys(int c)
{
char_u *p = typebuf.tb_buf + typebuf.tb_off;
Expand Down
2 changes: 1 addition & 1 deletion src/ex_docmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ do_cmdline_cmd(char_u *cmd)
* Execute the "+cmd" argument of "edit +cmd fname" and the like.
* This allows for using a range without ":" in Vim9 script.
*/
int
static int
do_cmd_argument(char_u *cmd)
{
return do_cmdline(cmd, NULL, NULL,
Expand Down
2 changes: 1 addition & 1 deletion src/getchar.c
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ stuffRedoReadbuff(char_u *s)
add_buff(&readbuf2, s, -1L);
}

void
static void
stuffReadbuffLen(char_u *s, long len)
{
add_buff(&readbuf1, s, len);
Expand Down
2 changes: 1 addition & 1 deletion src/job.c
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,7 @@ invoke_prompt_interrupt(void)
/*
* Return the effective prompt for the specified buffer.
*/
char_u *
static char_u *
buf_prompt_text(buf_T* buf)
{
if (buf->b_prompt_text == NULL)
Expand Down
2 changes: 1 addition & 1 deletion src/list.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ list_append_tv(list_T *l, typval_T *tv)
* As list_append_tv() but move the value instead of copying it.
* Return FAIL when out of memory.
*/
int
static int
list_append_tv_move(list_T *l, typval_T *tv)
{
listitem_T *li = listitem_alloc();
Expand Down
Loading

0 comments on commit 8ee52af

Please sign in to comment.