diff options
author | Ekaitz Zarraga <ekaitz@elenq.tech> | 2024-03-09 00:07:10 +0100 |
---|---|---|
committer | Ekaitz Zarraga <ekaitz@elenq.tech> | 2024-03-09 00:07:10 +0100 |
commit | 13e3354fff61c37555432d260a9b5d94ded4dd65 (patch) | |
tree | 709d3bddf02230499846bc9dca6d81c62ccacd1a /src | |
parent | 9caf870ef18f3a9d3876b72b13342f5caec45ad2 (diff) |
src: piece-table: fix style
Diffstat (limited to 'src')
-rw-r--r-- | src/piece-table.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/piece-table.c b/src/piece-table.c index e869ae2..6db05d7 100644 --- a/src/piece-table.c +++ b/src/piece-table.c @@ -71,7 +71,7 @@ static void free_piece_list(piece *p) { assert(p != NULL); for ( cur = p->next; cur != p; cur = next ) { next = cur->next; - free( cur ); + free(cur); } free(cur); } @@ -151,14 +151,14 @@ void delete_piece_table(piece_table *pt, size_t pos, size_t len) { piece *cur, *next, *start, *end; assert( pos + len <= pt->length ); - if ( pos == 0) { + if ( pos == 0 ) { start = pt->sentinel; } else { find_piece_by_pos(pt, pos); start = split_piece(pt->cached, pos - pt->cached_offset); } - if (pos + len == pt->length) { + if ( pos + len == pt->length ) { end = pt->sentinel; } else { find_piece_by_pos(pt, pos + len); @@ -170,6 +170,7 @@ void delete_piece_table(piece_table *pt, size_t pos, size_t len) { next = cur->next; free(cur); } + start->next = end; end->prev = start; pt->length -= len; |