Commit eb42421e authored by marko@hundin.mysql.fi's avatar marko@hundin.mysql.fi

InnoDB: Replace for loops with memset() where possible.

parent 3427c330
...@@ -2847,9 +2847,7 @@ btr_estimate_number_of_different_key_vals( ...@@ -2847,9 +2847,7 @@ btr_estimate_number_of_different_key_vals(
n_diff = mem_alloc((n_cols + 1) * sizeof(ib_longlong)); n_diff = mem_alloc((n_cols + 1) * sizeof(ib_longlong));
for (j = 0; j <= n_cols; j++) { memset(n_diff, 0, (n_cols + 1) * sizeof(ib_longlong));
n_diff[j] = 0;
}
/* We sample some pages in the index to get an estimate */ /* We sample some pages in the index to get an estimate */
......
...@@ -2101,10 +2101,6 @@ buf_print(void) ...@@ -2101,10 +2101,6 @@ buf_print(void)
n_found = 0; n_found = 0;
for (i = 0 ; i < size; i++) {
counts[i] = 0;
}
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
frame = buf_pool_get_nth_block(buf_pool, i)->frame; frame = buf_pool_get_nth_block(buf_pool, i)->frame;
......
...@@ -1672,7 +1672,6 @@ os_file_set_size( ...@@ -1672,7 +1672,6 @@ os_file_set_size(
ibool ret; ibool ret;
byte* buf; byte* buf;
byte* buf2; byte* buf2;
ulint i;
ut_a(size == (size & 0xFFFFFFFF)); ut_a(size == (size & 0xFFFFFFFF));
...@@ -1685,9 +1684,7 @@ os_file_set_size( ...@@ -1685,9 +1684,7 @@ os_file_set_size(
buf = ut_align(buf2, UNIV_PAGE_SIZE); buf = ut_align(buf2, UNIV_PAGE_SIZE);
/* Write buffer full of zeros */ /* Write buffer full of zeros */
for (i = 0; i < UNIV_PAGE_SIZE * 512; i++) { memset(buf, 0, UNIV_PAGE_SIZE * 512);
buf[i] = '\0';
}
offset = 0; offset = 0;
low = (ib_longlong)size + (((ib_longlong)size_high) << 32); low = (ib_longlong)size + (((ib_longlong)size_high) << 32);
......
...@@ -1755,9 +1755,7 @@ page_validate( ...@@ -1755,9 +1755,7 @@ page_validate(
records in the page record heap do not overlap */ records in the page record heap do not overlap */
buf = mem_heap_alloc(heap, UNIV_PAGE_SIZE); buf = mem_heap_alloc(heap, UNIV_PAGE_SIZE);
for (i = 0; i < UNIV_PAGE_SIZE; i++) { memset(buf, 0, UNIV_PAGE_SIZE);
buf[i] = 0;
}
/* Check first that the record heap and the directory do not /* Check first that the record heap and the directory do not
overlap. */ overlap. */
......
...@@ -941,13 +941,11 @@ trx_undo_erase_page_end( ...@@ -941,13 +941,11 @@ trx_undo_erase_page_end(
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
ulint first_free; ulint first_free;
ulint i;
first_free = mach_read_from_2(undo_page + TRX_UNDO_PAGE_HDR first_free = mach_read_from_2(undo_page + TRX_UNDO_PAGE_HDR
+ TRX_UNDO_PAGE_FREE); + TRX_UNDO_PAGE_FREE);
for (i = first_free; i < UNIV_PAGE_SIZE - FIL_PAGE_DATA_END; i++) { memset(undo_page + first_free, 0xff,
undo_page[i] = 0xFF; (UNIV_PAGE_SIZE - FIL_PAGE_DATA_END) - first_free);
}
mlog_write_initial_log_record(undo_page, MLOG_UNDO_ERASE_END, mtr); mlog_write_initial_log_record(undo_page, MLOG_UNDO_ERASE_END, mtr);
} }
......
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