D3499: revlog: use node tree (native code) for shortest() calculation

Yuya Nishihara yuya at tcha.org
Fri May 11 09:59:30 EDT 2018


> +static int nt_shortest(indexObject *self, const char *node)
> +{
> +	int level, off;
> +
> +	if (nt_init(self) == -1)
> +		return -3;
> +	if (nt_populate(self) == -1)
> +		return -3;
> +
> +	for (level = off = 0; level < 40; level++) {
> +		int k, v;
> +		nodetree *n = &self->nt[off];
> +		k = nt_level(node, level);
> +		v = n->children[k];
> +		if (v < 0) {
> +			v = -(v + 1);
> +			const char *n = index_node(self, v);

Perhaps we should check if n == NULL. index_node_existing() might be more
appropriate.

Can you send a followup?


More information about the Mercurial-devel mailing list