xfree86/parser: move StringToToken() definition further up

... so that we can use it without the forward declaration. Plus we're
doing to reuse it in the next commit ;-)

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
This commit is contained in:
Emil Velikov 2016-04-17 20:30:44 +01:00 committed by Adam Jackson
parent b93be14b7d
commit 944ea03d5b

View File

@ -87,8 +87,6 @@
#define CONFIG_BUF_LEN 1024
#define CONFIG_MAX_FILES 64
static int StringToToken(const char *, const xf86ConfigSymTabRec *);
static struct {
FILE *file;
char *path;
@ -241,6 +239,18 @@ xf86getNextLine(void)
return ret;
}
static int
StringToToken(const char *str, const xf86ConfigSymTabRec * tab)
{
int i;
for (i = 0; tab[i].token != -1; i++) {
if (!xf86nameCompare(tab[i].name, str))
return tab[i].token;
}
return ERROR_TOKEN;
}
/*
* xf86getToken --
* Read next Token from the config file. Handle the global variable
@ -1028,18 +1038,6 @@ xf86getStringToken(const xf86ConfigSymTabRec * tab)
return StringToToken(xf86_lex_val.str, tab);
}
static int
StringToToken(const char *str, const xf86ConfigSymTabRec * tab)
{
int i;
for (i = 0; tab[i].token != -1; i++) {
if (!xf86nameCompare(tab[i].name, str))
return tab[i].token;
}
return ERROR_TOKEN;
}
/*
* Compare two names. The characters '_', ' ', and '\t' are ignored
* in the comparison.