[dpdk-dev] [PATCH] log: add API to check if a logtype can log in a given level

Stephen Hemminger stephen at networkplumber.org
Tue Mar 3 17:02:03 CET 2020


On Tue,  3 Mar 2020 13:25:12 +0000
Ferruh Yigit <ferruh.yigit at intel.com> wrote:

>  
> +int
> +rte_log_can_log(uint32_t logtype, uint32_t level)
> +{
> +	int log_level;
> +
> +	if (level > rte_log_get_global_level())
> +		return 0;
> +
> +	log_level = rte_log_get_level(logtype);
> +	if (log_level < 0)
> +		return 0;
> +
> +	if (level > (uint32_t)log_level)
> +		return 0;
> +
> +	return 1;
> +}

Why not use a boolean (stdbool) for return value?


More information about the dev mailing list