From 13e3354fff61c37555432d260a9b5d94ded4dd65 Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Sat, 9 Mar 2024 00:07:10 +0100 Subject: src: piece-table: fix style --- src/piece-table.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') 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; -- cgit v1.2.3