Commit f2bcb9ca authored by marko's avatar marko

branches/zip: row_merge_sort_linked_list_in_disk(): Remove some unnecessary

assignments.  A memory leak remains at "goto error_handling": the memory
allocated with row_merge_block_create() in the beginning of this function
will not be freed.
parent d33e525a
...@@ -1121,7 +1121,6 @@ row_merge_sort_linked_list_in_disk( ...@@ -1121,7 +1121,6 @@ row_merge_sort_linked_list_in_disk(
{ {
merge_block_t* block1; merge_block_t* block1;
merge_block_t* block2; merge_block_t* block2;
merge_block_t* tmp;
merge_block_t* backup1; merge_block_t* backup1;
merge_block_t* backup2; merge_block_t* backup2;
merge_block_header_t header; merge_block_header_t header;
...@@ -1135,16 +1134,12 @@ row_merge_sort_linked_list_in_disk( ...@@ -1135,16 +1134,12 @@ row_merge_sort_linked_list_in_disk(
dulint list_tail; dulint list_tail;
dulint offset; dulint offset;
ibool list_is_empty; ibool list_is_empty;
int selected;
ut_ad(index); ut_ad(index);
/* Allocate memory for blocks */ /* Allocate memory for blocks */
block1 = row_merge_block_create(); backup1 = block1 = row_merge_block_create();
block2 = row_merge_block_create(); backup2 = block2 = row_merge_block_create();
backup1 = block1;
backup2 = block2;
tmp = NULL;
list_head = ut_dulint_create(0, 0); list_head = ut_dulint_create(0, 0);
list_tail = ut_dulint_create(0, 0); list_tail = ut_dulint_create(0, 0);
...@@ -1154,7 +1149,6 @@ row_merge_sort_linked_list_in_disk( ...@@ -1154,7 +1149,6 @@ row_merge_sort_linked_list_in_disk(
block_size = 1; /* We start from block size 1 */ block_size = 1; /* We start from block size 1 */
for (;;) { for (;;) {
tmp = NULL;
block1 = backup1; block1 = backup1;
row_merge_block_read(file, block1, list_head); row_merge_block_read(file, block1, list_head);
...@@ -1165,7 +1159,7 @@ row_merge_sort_linked_list_in_disk( ...@@ -1165,7 +1159,7 @@ row_merge_sort_linked_list_in_disk(
num_of_merges = 0; /* We count number of merges we do in num_of_merges = 0; /* We count number of merges we do in
this pass */ this pass */
while (block1) { for (;;) {
num_of_merges++; num_of_merges++;
header = block1->header; header = block1->header;
...@@ -1213,9 +1207,8 @@ row_merge_sort_linked_list_in_disk( ...@@ -1213,9 +1207,8 @@ row_merge_sort_linked_list_in_disk(
/* Merge sort two lists by deciding whether /* Merge sort two lists by deciding whether
next element of merge comes from list1 or next element of merge comes from list1 or
list2. */ list2. */
merge_block_t* tmp;
selected = 0; ulint selected;
tmp = NULL;
if (list1_size == 0) { if (list1_size == 0) {
/* First list is empty, next element /* First list is empty, next element
...@@ -1243,8 +1236,8 @@ row_merge_sort_linked_list_in_disk( ...@@ -1243,8 +1236,8 @@ row_merge_sort_linked_list_in_disk(
/* Both lists contain a block and we /* Both lists contain a block and we
need to merge records on these block */ need to merge records on these block */
tmp = row_merge_block_merge(block1, tmp = row_merge_block_merge(
&block2, index); block1, &block2, index);
block1 = tmp; block1 = tmp;
backup1 = tmp; backup1 = tmp;
...@@ -1289,18 +1282,17 @@ row_merge_sort_linked_list_in_disk( ...@@ -1289,18 +1282,17 @@ row_merge_sort_linked_list_in_disk(
} }
} }
/* Now we have processed block_size items from the disk. /* Now we have processed block_size items from
Swap blocks using pointers. */ the disk. Swap blocks using pointers. */
if (block2) { if (!block2) {
tmp = block2; break;
block2 = block1;
block1 = tmp;
backup1 = block1;
backup2 = block2;
} else {
block1 = NULL;
} }
block2 = backup1;
block1 = backup2;
backup2 = block2;
backup1 = block1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment