src/or/consdiff.c
static int
next_router(smartlist_t *cons, int cur)
{
  int len = smartlist_len(cons);
  tor_assert(cur >= -1 && cur < len);

  if (++cur >= len) {
    return len;
  }

  const char *line = smartlist_get(cons, cur);
  while (!is_valid_router_entry(line)) {
    if (++cur >= len) {
      return len;
    }
    line = smartlist_get(cons, cur);
  }
  return cur;
}
/** Helper: Find the next router line starting at the current position.
 * Assumes that cur is lower than the length of the smartlist, i.e. it is a
 * line within the bounds of the consensus. The only exception is when we
 * don't want to skip the first line, in which case cur will be -1.
 */
Find the next router line starting at the current position.
Assumes that cur is lower than the length of the smartlist, i.e. it is a
line within the bounds of the consensus. The only exception is when we
don't want to skip the first line, in which case cur will be -1.
Find the next router line starting at the current position . Assumes that cur is lower than the length of the smartlist i . e . it is a line within the bounds of the consensus . The only exception is when we don ' t want to skip the first line in which case cur will be - 1 .
static int
next_router(smartlist_t *cons, int cur)
{
  int len = smartlist_len(cons);
  tor_assert(cur >= -1 && cur < len);
  if (++cur >= len) {
    return len;
  }
  const char *line = smartlist_get(cons, cur);
  while (!is_valid_router_entry(line)) {
    if (++cur >= len) {
      return len;
    }
    line = smartlist_get(cons, cur);
  }
  return cur;
}
static int next_router ( smartlist_t * cons , int cur ) { int len = smartlist_len ( cons ) ; tor_assert ( cur >= -1 && cur < len ) ; if ( ++ cur >= len ) { return len ; } const char * line = smartlist_get ( cons , cur ) ; while ( ! is_valid_router_entry ( line ) ) { if ( ++ cur >= len ) { return len ; } line = smartlist_get ( cons , cur ) ; } return cur ; }
Helper: Find the next router line starting at the current position.
Helper : Find the next router line starting at the current position .