Skip to content

Commit

Permalink
Prepare log_get_from_idx for log compaction
Browse files Browse the repository at this point in the history
  • Loading branch information
willemt committed Jan 29, 2016
1 parent a20e859 commit 56f6521
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/raft_log.c
Expand Up @@ -118,12 +118,12 @@ raft_entry_t* log_get_from_idx(log_t* me_, int idx, int *n_etys)

i = (me->front + idx - me->base) % me->size;

assert(i <= me->back);
int logs_till_end_of_log;

int logs_till_end_of_log = me->back - i;

/* idx - me->front - me->base; */
/* i = */
if (i < me->back)
logs_till_end_of_log = me->back - i;
else
logs_till_end_of_log = me->size - i;

*n_etys = logs_till_end_of_log;
return &me->entries[i];
Expand Down

0 comments on commit 56f6521

Please sign in to comment.