Skip to content

Commit 318d468

Browse files
committed
main,refactor: reduce the number of calling getNamedLanguage
Signed-off-by: Masatake YAMATO <[email protected]>
1 parent c982b5e commit 318d468

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

main/options.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2564,9 +2564,8 @@ static void processHeaderListOption (const int option, const char *parameter)
25642564
/*
25652565
* Token ignore processing
25662566
*/
2567-
static void readIgnoreList (const char *const list)
2567+
static void readIgnoreList (langType lang, const char *const list)
25682568
{
2569-
langType lang = getNamedLanguage ("CPreProcessor", 0);
25702569
char* newList = stringCopy (list);
25712570
const char *token = strtok (newList, IGNORE_SEPARATORS);
25722571

@@ -2578,10 +2577,8 @@ static void readIgnoreList (const char *const list)
25782577
eFree (newList);
25792578
}
25802579

2581-
static void addIgnoreListFromFile (const char *const fileName)
2580+
static void addIgnoreListFromFile (langType lang, const char *const fileName)
25822581
{
2583-
langType lang = getNamedLanguage ("CPreProcessor", 0);
2584-
25852582
stringList* tokens = stringListNewFromFile (fileName);
25862583
if (tokens == NULL)
25872584
error (FATAL | PERROR, "cannot open \"%s\"", fileName);
@@ -2607,16 +2604,16 @@ static void processIgnoreOption (const char *const list, int IgnoreOrDefine)
26072604
else if (strchr ("@./\\", list [0]) != NULL)
26082605
{
26092606
const char* fileName = (*list == '@') ? list + 1 : list;
2610-
addIgnoreListFromFile (fileName);
2607+
addIgnoreListFromFile (lang, fileName);
26112608
}
26122609
#if defined (WIN32)
26132610
else if (isalpha (list [0]) && list [1] == ':')
2614-
addIgnoreListFromFile (list);
2611+
addIgnoreListFromFile (lang, list);
26152612
#endif
26162613
else if (strcmp (list, "-") == 0)
26172614
applyLanguageParam (lang, "ignore", NULL);
26182615
else
2619-
readIgnoreList (list);
2616+
readIgnoreList (lang, list);
26202617
}
26212618

26222619
static void processAnonHashOption (const char *const option CTAGS_ATTR_UNUSED, const char *const parameter CTAGS_ATTR_UNUSED)

0 commit comments

Comments
 (0)