mirror of
https://github.com/neovim/neovim.git
synced 2025-09-12 22:38:16 +00:00
Refactor vim_tempname
- temp_count is uint32_t now instead of long because it supposed to be at most 999999999 (comment on line 5227) temporary files. The most probably it was a long for compatibility with systems where int is 16-bit. - Use "nvim" as prefix for temp folder name instead of "v" - Remove unused parameter from vim_tempname
This commit is contained in:

committed by
Nicolas Hillegeer

parent
edd7a8c5dd
commit
29e0cd1571
@@ -14030,7 +14030,7 @@ static void f_system(typval_T *argvars, typval_T *rettv)
|
||||
* Write the string to a temp file, to be used for input of the shell
|
||||
* command.
|
||||
*/
|
||||
if ((infile = vim_tempname('i')) == NULL) {
|
||||
if ((infile = vim_tempname()) == NULL) {
|
||||
EMSG(_(e_notmp));
|
||||
goto done;
|
||||
}
|
||||
@@ -14231,22 +14231,8 @@ static void f_taglist(typval_T *argvars, typval_T *rettv)
|
||||
*/
|
||||
static void f_tempname(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
static int x = 'A';
|
||||
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = vim_tempname(x);
|
||||
|
||||
/* Advance 'x' to use A-Z and 0-9, so that there are at least 34 different
|
||||
* names. Skip 'I' and 'O', they are used for shell redirection. */
|
||||
do {
|
||||
if (x == 'Z')
|
||||
x = '0';
|
||||
else if (x == '9')
|
||||
x = 'A';
|
||||
else {
|
||||
++x;
|
||||
}
|
||||
} while (x == 'I' || x == 'O');
|
||||
rettv->vval.v_string = vim_tempname();
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user