tools/nxstyle: Add the suffix white list
and initialize it to "kHz", "Mbps", and "us" Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
ad57791fe0
commit
317cc6c174
@ -209,6 +209,14 @@ static const char *g_white_prefix[] =
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char *g_white_suffix[] =
|
||||
{
|
||||
"kHz",
|
||||
"Mbps",
|
||||
"us",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char *g_white_list[] =
|
||||
{
|
||||
/* Ref: gnu_unwind_find_exidx.c */
|
||||
@ -715,12 +723,32 @@ static bool white_list(const char *ident, int lineno)
|
||||
{
|
||||
const char **pptr;
|
||||
const char *str;
|
||||
size_t len2;
|
||||
size_t len;
|
||||
|
||||
for (pptr = g_white_prefix;
|
||||
(str = *pptr) != NULL;
|
||||
pptr++)
|
||||
{
|
||||
if (strncmp(ident, str, strlen(str)) == 0)
|
||||
len = strlen(str);
|
||||
if (strncmp(ident, str, len) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
len2 = strlen(ident);
|
||||
while (!isalnum(ident[len2]))
|
||||
{
|
||||
len2--;
|
||||
}
|
||||
|
||||
for (pptr = g_white_suffix;
|
||||
(str = *pptr) != NULL;
|
||||
pptr++)
|
||||
{
|
||||
len = strlen(str);
|
||||
if (len2 >= len && strncmp(ident + len2 - len, str, len) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -730,8 +758,7 @@ static bool white_list(const char *ident, int lineno)
|
||||
(str = *pptr) != NULL;
|
||||
pptr++)
|
||||
{
|
||||
size_t len = strlen(str);
|
||||
|
||||
len = strlen(str);
|
||||
if (strncmp(ident, str, len) == 0 &&
|
||||
isalnum(ident[len]) == 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user