[PATCH 4/6] Add hash support to link cache

Thomas Graf tgraf at suug.ch
Mon Nov 5 06:58:31 EST 2012


On 11/04/12 at 09:13pm, roopa at cumulusnetworks.com wrote:
> From: roopa <roopa at cumulusnetworks.com>
> +static void link_keygen(struct nl_object *obj, uint32_t *hashkey,
> +        uint32_t table_sz)
> +{
> +	struct rtnl_link *link = (struct rtnl_link *) obj;
> +	struct link_hash_key *_key;
> +	unsigned int _key_sz;
> +	struct link_hash_key {
> +		uint32_t	l_index;
> +	};
> +
> +	_key_sz = sizeof(struct link_hash_key);
> +
> +	_key = calloc(1 , _key_sz);

Why allocate this? Why not just throw it onto the stack?



More information about the libnl mailing list