mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 05:28:33 +00:00
ex_cmds: add const to helptags_one() variables
This commit is contained in:
@@ -5130,21 +5130,16 @@ void ex_viusage(exarg_T *eap)
|
|||||||
/// @param tagname Name of the tags file ("tags" for English, "tags-fr" for
|
/// @param tagname Name of the tags file ("tags" for English, "tags-fr" for
|
||||||
/// French)
|
/// French)
|
||||||
/// @param add_help_tags Whether to add the "help-tags" tag
|
/// @param add_help_tags Whether to add the "help-tags" tag
|
||||||
static void helptags_one(char_u *dir, char_u *ext, char_u *tagfname,
|
static void helptags_one(char_u *const dir, const char_u *const ext,
|
||||||
bool add_help_tags)
|
const char_u *const tagfname, const bool add_help_tags)
|
||||||
{
|
{
|
||||||
FILE *fd_tags;
|
|
||||||
FILE *fd;
|
|
||||||
garray_T ga;
|
garray_T ga;
|
||||||
int filecount;
|
int filecount;
|
||||||
char_u **files;
|
char_u **files;
|
||||||
char_u *p1, *p2;
|
char_u *p1, *p2;
|
||||||
int fi;
|
|
||||||
char_u *s;
|
char_u *s;
|
||||||
char_u *fname;
|
|
||||||
TriState utf8 = kNone;
|
TriState utf8 = kNone;
|
||||||
int firstline;
|
bool mix = false; // detected mixed encodings
|
||||||
int mix = FALSE; /* detected mixed encodings */
|
|
||||||
|
|
||||||
// Find all *.txt files.
|
// Find all *.txt files.
|
||||||
size_t dirlen = STRLCPY(NameBuff, dir, sizeof(NameBuff));
|
size_t dirlen = STRLCPY(NameBuff, dir, sizeof(NameBuff));
|
||||||
@@ -5177,7 +5172,8 @@ static void helptags_one(char_u *dir, char_u *ext, char_u *tagfname,
|
|||||||
EMSG(_(e_fnametoolong));
|
EMSG(_(e_fnametoolong));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fd_tags = mch_fopen((char *)NameBuff, "w");
|
|
||||||
|
FILE *const fd_tags = mch_fopen((char *)NameBuff, "w");
|
||||||
if (fd_tags == NULL) {
|
if (fd_tags == NULL) {
|
||||||
EMSG2(_("E152: Cannot open %s for writing"), NameBuff);
|
EMSG2(_("E152: Cannot open %s for writing"), NameBuff);
|
||||||
FreeWild(filecount, files);
|
FreeWild(filecount, files);
|
||||||
@@ -5200,15 +5196,15 @@ static void helptags_one(char_u *dir, char_u *ext, char_u *tagfname,
|
|||||||
/*
|
/*
|
||||||
* Go over all the files and extract the tags.
|
* Go over all the files and extract the tags.
|
||||||
*/
|
*/
|
||||||
for (fi = 0; fi < filecount && !got_int; ++fi) {
|
for (int fi = 0; fi < filecount && !got_int; fi++) {
|
||||||
fd = mch_fopen((char *)files[fi], "r");
|
FILE *const fd = mch_fopen((char *)files[fi], "r");
|
||||||
if (fd == NULL) {
|
if (fd == NULL) {
|
||||||
EMSG2(_("E153: Unable to open %s for reading"), files[fi]);
|
EMSG2(_("E153: Unable to open %s for reading"), files[fi]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
fname = files[fi] + dirlen + 1;
|
const char_u *const fname = files[fi] + dirlen + 1;
|
||||||
|
|
||||||
firstline = TRUE;
|
bool firstline = true;
|
||||||
while (!vim_fgets(IObuff, IOSIZE, fd) && !got_int) {
|
while (!vim_fgets(IObuff, IOSIZE, fd) && !got_int) {
|
||||||
if (firstline) {
|
if (firstline) {
|
||||||
// Detect utf-8 file by a non-ASCII char in the first line.
|
// Detect utf-8 file by a non-ASCII char in the first line.
|
||||||
@@ -5237,7 +5233,7 @@ static void helptags_one(char_u *dir, char_u *ext, char_u *tagfname,
|
|||||||
mix = !got_int;
|
mix = !got_int;
|
||||||
got_int = TRUE;
|
got_int = TRUE;
|
||||||
}
|
}
|
||||||
firstline = FALSE;
|
firstline = false;
|
||||||
}
|
}
|
||||||
p1 = vim_strchr(IObuff, '*'); /* find first '*' */
|
p1 = vim_strchr(IObuff, '*'); /* find first '*' */
|
||||||
while (p1 != NULL) {
|
while (p1 != NULL) {
|
||||||
|
Reference in New Issue
Block a user