tools/nxstyle: Support the white list
and add _Exit to the white list Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
861f80e853
commit
b2f3a4b5f9
@ -195,6 +195,12 @@ static const char *g_white_prefix[] =
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char *g_white_list[] =
|
||||
{
|
||||
"_Exit", /* Ref: stdlib.h */
|
||||
NULL
|
||||
};
|
||||
|
||||
/********************************************************************************
|
||||
* Private Functions
|
||||
********************************************************************************/
|
||||
@ -502,7 +508,7 @@ static bool check_section_header(const char *line, int lineno)
|
||||
*
|
||||
********************************************************************************/
|
||||
|
||||
static bool white_prefix(const char *ident, int lineno)
|
||||
static bool white_list(const char *ident, int lineno)
|
||||
{
|
||||
const char **pptr;
|
||||
const char *str;
|
||||
@ -517,6 +523,19 @@ static bool white_prefix(const char *ident, int lineno)
|
||||
}
|
||||
}
|
||||
|
||||
for (pptr = g_white_list;
|
||||
(str = *pptr) != NULL;
|
||||
pptr++)
|
||||
{
|
||||
size_t len = strlen(str);
|
||||
|
||||
if (strncmp(ident, str, len) == 0 &&
|
||||
isalnum(ident[len]) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1485,7 +1504,7 @@ int main(int argc, char **argv, char **envp)
|
||||
{
|
||||
/* Ignore symbols that begin with white-listed prefixes */
|
||||
|
||||
if (white_prefix(&line[ident_index], lineno))
|
||||
if (white_list(&line[ident_index], lineno))
|
||||
{
|
||||
/* No error */
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user