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

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Thu May 10 12:01:42 EDT 2018


martinvonz added a comment.


  In https://phab.mercurial-scm.org/D3499#55772, @yuja wrote:
  
  > Looks generally good, but can you fix your editor to not do Google indent?
  
  
  Wow, we still use tabs?! Okay, will change.
  
  > I'm not sure if we should bump the module version in this case, but I would
  >  do that just for sanity.
  
  Done, I think, but please check that I did it right.
  
  > 
  > 
  >> +static int nt_shortest(indexObject *self, const char *node)
  >>  +{
  >>  +  if (nt_init(self) == -1)
  >>  +    return -3;
  >>  +  if (nt_populate(self) == -1)
  >>  +    return -3;
  >>  +
  >>  +  int level, off;
  > 
  > Declaration has to be moved to top.
  
  Done.
  
  > 
  > 
  >> +  for (level = off = 0; level < 40; level++) {
  >>  +    int k = nt_level(node, level);
  >>  +    nodetree *n = &self->nt[off];
  >>  +    int v = n->children[k];
  >>  +    if (v < 0) {
  >>  +      v = -(v + 1);
  >>  +      const char *n = index_node(self, v);
  > 
  > Here, too.
  
  Done.

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