lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210115100839.GB1478666@krava>
Date:   Fri, 15 Jan 2021 11:08:39 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Ian Rogers <irogers@...gle.com>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Namhyung Kim <namhyung@...nel.org>,
        linux-kernel@...r.kernel.org, Andi Kleen <ak@...ux.intel.com>,
        Jin Yao <yao.jin@...ux.intel.com>,
        John Garry <john.garry@...wei.com>,
        Paul Clarke <pc@...ibm.com>, kajoljain <kjain@...ux.ibm.com>,
        Stephane Eranian <eranian@...gle.com>,
        Sandeep Dasgupta <sdasgup@...gle.com>
Subject: Re: [PATCH v7 4/5] perf metric: Add utilities to work on ids map.

On Tue, Jan 12, 2021 at 03:04:33PM -0800, Ian Rogers wrote:

SNIP

>  
> +struct hashmap *ids__union(struct hashmap *ids1, struct hashmap *ids2)
> +{
> +	size_t bkt;
> +	struct hashmap_entry *cur;
> +	int ret;
> +	struct expr_id_data *old_data = NULL;
> +	char *old_key = NULL;
> +
> +	if (!ids1)
> +		return ids2;
> +
> +	if (!ids2)
> +		return ids1;
> +
> +	if (hashmap__size(ids1) <  hashmap__size(ids2)) {
> +		struct hashmap *tmp = ids1;
> +
> +		ids1 = ids2;
> +		ids2 = tmp;
> +	}
> +	hashmap__for_each_entry(ids2, cur, bkt) {
> +		ret = hashmap__set(ids1, cur->key, cur->value,
> +				(const void **)&old_key, (void **)&old_data);
> +		free(old_key);
> +		free(old_data);
> +
> +		if (ret)
> +			break;

should this return NULL instead?

> +	}
> +	hashmap__free(ids2);
> +	return ids1;
> +}
> +

SNIP

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ