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

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri May 11 15:31:57 EDT 2018


martinvonz added a comment.


  In https://phab.mercurial-scm.org/D3499#55925, @yuja wrote:
  
  > > +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.
  
  
  Oops, funny how I missed that after just having added index_node_existing. Thanks for noticing.
  
  > Can you send a followup?
  
  Will do. Feel free to fold in.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3499

To: martinvonz, indygreg, #hg-reviewers
Cc: yuja, mercurial-devel


More information about the Mercurial-devel mailing list