[PATCH 24.03 v2 1/5] arg_parser: new library for command line parsing

Stephen Hemminger stephen at networkplumber.org
Wed Nov 29 23:14:13 CET 2023


On Tue, 28 Nov 2023 14:07:41 +0000
Euan Bourke <euan.bourke at intel.com> wrote:

> +int
> +rte_parse_corelist(const char *corelist, uint16_t *cores, uint32_t cores_len)
> +{
> +	int32_t min = -1;
> +	char *end = NULL;
> +
> +	struct core_bits *mask = malloc(sizeof(struct core_bits));
> +	if (mask == NULL)
> +		return -1;
> +	memset(mask, 0, sizeof(struct core_bits));
> +

The structure is not variable size, and small, why bother using malloc().
Just use on stack structure.


More information about the dev mailing list