mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-16 01:44:34 +00:00
log: make log_has_file() static
Function log_has_file() is not used externally. Make it static. Rename the function to log_has_member() as we can reuse for filtering other strings. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
parent
9f00d38ce7
commit
1daacb9275
2 changed files with 14 additions and 18 deletions
20
common/log.c
20
common/log.c
|
@ -130,17 +130,25 @@ bool log_has_cat(enum log_category_t cat_list[], enum log_category_t cat)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool log_has_file(const char *file_list, const char *file)
|
||||
/**
|
||||
* log_has_member() - check if a string is in a comma separated list
|
||||
*
|
||||
* @list: Comma separated list of strings
|
||||
* @member: String to find
|
||||
*
|
||||
* Return: ``true`` if @member is in @list, else ``false``
|
||||
*/
|
||||
static bool log_has_member(const char *list, const char *member)
|
||||
{
|
||||
int file_len = strlen(file);
|
||||
int member_len = strlen(member);
|
||||
const char *s, *p;
|
||||
int substr_len;
|
||||
|
||||
for (s = file_list; *s; s = p + (*p != '\0')) {
|
||||
for (s = list; *s; s = p + (*p != '\0')) {
|
||||
p = strchrnul(s, ',');
|
||||
substr_len = p - s;
|
||||
if (file_len >= substr_len &&
|
||||
!strncmp(file + file_len - substr_len, s, substr_len))
|
||||
if (member_len >= substr_len &&
|
||||
!strncmp(member + member_len - substr_len, s, substr_len))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -181,7 +189,7 @@ static bool log_passes_filters(struct log_device *ldev, struct log_rec *rec)
|
|||
continue;
|
||||
|
||||
if (filt->file_list &&
|
||||
!log_has_file(filt->file_list, rec->file))
|
||||
!log_has_member(filt->file_list, rec->file))
|
||||
continue;
|
||||
|
||||
if (filt->flags & LOGFF_DENY)
|
||||
|
|
|
@ -571,18 +571,6 @@ struct log_device *log_device_find_by_name(const char *drv_name);
|
|||
*/
|
||||
bool log_has_cat(enum log_category_t cat_list[], enum log_category_t cat);
|
||||
|
||||
/**
|
||||
* log_has_file() - check if a file is with a list
|
||||
*
|
||||
* @file_list: List of files to check, separated by comma
|
||||
* @file: File to check for. This string is matched against the end of each
|
||||
* file in the list, i.e. ignoring any preceding path. The list is
|
||||
* intended to consist of relative pathnames, e.g. common/main.c,cmd/log.c
|
||||
*
|
||||
* Return: ``true`` if @file is in @file_list, else ``false``
|
||||
*/
|
||||
bool log_has_file(const char *file_list, const char *file);
|
||||
|
||||
/* Log format flags (bit numbers) for gd->log_fmt. See log_fmt_chars */
|
||||
enum log_fmt {
|
||||
LOGF_CAT = 0,
|
||||
|
|
Loading…
Add table
Reference in a new issue