Commit 52d2051e authored by osku's avatar osku

Change ut_print_buf() and mem_analyze_corruption() to take a void*, not a

byte*. Remove redundant casts from callers.
parent c016a86f
...@@ -158,7 +158,7 @@ btr_pcur_copy_stored_position( ...@@ -158,7 +158,7 @@ btr_pcur_copy_stored_position(
mem_free(pcur_receive->old_rec_buf); mem_free(pcur_receive->old_rec_buf);
} }
ut_memcpy((byte*)pcur_receive, (byte*)pcur_donate, sizeof(btr_pcur_t)); ut_memcpy(pcur_receive, pcur_donate, sizeof(btr_pcur_t));
if (pcur_donate->old_rec_buf) { if (pcur_donate->old_rec_buf) {
......
...@@ -120,7 +120,7 @@ buf_flush_ready_for_replace( ...@@ -120,7 +120,7 @@ buf_flush_ready_for_replace(
fprintf(stderr, fprintf(stderr,
" InnoDB: Error: buffer block state %lu in the LRU list!\n", " InnoDB: Error: buffer block state %lu in the LRU list!\n",
(ulong)block->state); (ulong)block->state);
ut_print_buf(stderr, (byte*)block, sizeof(buf_block_t)); ut_print_buf(stderr, block, sizeof(buf_block_t));
return(FALSE); return(FALSE);
} }
......
...@@ -792,7 +792,7 @@ check_trx_exists( ...@@ -792,7 +792,7 @@ check_trx_exists(
thd->ha_data[innobase_hton.slot] = trx; thd->ha_data[innobase_hton.slot] = trx;
} else { } else {
if (trx->magic_n != TRX_MAGIC_N) { if (trx->magic_n != TRX_MAGIC_N) {
mem_analyze_corruption((byte*)trx); mem_analyze_corruption(trx);
ut_a(0); ut_a(0);
} }
......
...@@ -114,7 +114,7 @@ the neighborhood of a given pointer. */ ...@@ -114,7 +114,7 @@ the neighborhood of a given pointer. */
void void
mem_analyze_corruption( mem_analyze_corruption(
/*===================*/ /*===================*/
byte* ptr); /* in: pointer to place of possible corruption */ void* ptr); /* in: pointer to place of possible corruption */
/********************************************************************* /*********************************************************************
Prints information of dynamic memory usage and currently allocated memory Prints information of dynamic memory usage and currently allocated memory
heaps or buffers. Can only be used in the debug version. */ heaps or buffers. Can only be used in the debug version. */
......
...@@ -202,7 +202,7 @@ void ...@@ -202,7 +202,7 @@ void
ut_print_buf( ut_print_buf(
/*=========*/ /*=========*/
FILE* file, /* in: file where to print */ FILE* file, /* in: file where to print */
const byte* buf, /* in: memory buffer */ const void* buf, /* in: memory buffer */
ulint len); /* in: length of the buffer */ ulint len); /* in: length of the buffer */
/************************************************************************** /**************************************************************************
......
...@@ -733,18 +733,18 @@ the neighborhood of a given pointer. */ ...@@ -733,18 +733,18 @@ the neighborhood of a given pointer. */
void void
mem_analyze_corruption( mem_analyze_corruption(
/*===================*/ /*===================*/
byte* ptr) /* in: pointer to place of possible corruption */ void* ptr) /* in: pointer to place of possible corruption */
{ {
byte* p; byte* p;
ulint i; ulint i;
ulint dist; ulint dist;
fputs("InnoDB: Apparent memory corruption: mem dump ", stderr); fputs("InnoDB: Apparent memory corruption: mem dump ", stderr);
ut_print_buf(stderr, ptr - 250, 500); ut_print_buf(stderr, (byte*)ptr - 250, 500);
fputs("\nInnoDB: Scanning backward trying to find previous allocated mem blocks\n", stderr); fputs("\nInnoDB: Scanning backward trying to find previous allocated mem blocks\n", stderr);
p = ptr; p = (byte*)ptr;
dist = 0; dist = 0;
for (i = 0; i < 10; i++) { for (i = 0; i < 10; i++) {
...@@ -781,7 +781,7 @@ mem_analyze_corruption( ...@@ -781,7 +781,7 @@ mem_analyze_corruption(
fprintf(stderr, fprintf(stderr,
"InnoDB: Scanning forward trying to find next allocated mem blocks\n"); "InnoDB: Scanning forward trying to find next allocated mem blocks\n");
p = ptr; p = (byte*)ptr;
dist = 0; dist = 0;
for (i = 0; i < 10; i++) { for (i = 0; i < 10; i++) {
......
...@@ -141,7 +141,7 @@ mem_heap_create_block( ...@@ -141,7 +141,7 @@ mem_heap_create_block(
|| (type == MEM_HEAP_BUFFER + MEM_HEAP_BTR_SEARCH)); || (type == MEM_HEAP_BUFFER + MEM_HEAP_BTR_SEARCH));
if (heap && heap->magic_n != MEM_BLOCK_MAGIC_N) { if (heap && heap->magic_n != MEM_BLOCK_MAGIC_N) {
mem_analyze_corruption((byte*)heap); mem_analyze_corruption(heap);
} }
/* In dynamic allocation, calculate the size: block header + data. */ /* In dynamic allocation, calculate the size: block header + data. */
...@@ -286,7 +286,7 @@ mem_heap_block_free( ...@@ -286,7 +286,7 @@ mem_heap_block_free(
ibool init_block; ibool init_block;
if (block->magic_n != MEM_BLOCK_MAGIC_N) { if (block->magic_n != MEM_BLOCK_MAGIC_N) {
mem_analyze_corruption((byte*)block); mem_analyze_corruption(block);
} }
UT_LIST_REMOVE(list, heap->base, block); UT_LIST_REMOVE(list, heap->base, block);
...@@ -361,7 +361,7 @@ mem_validate_all_blocks(void) ...@@ -361,7 +361,7 @@ mem_validate_all_blocks(void)
while (block) { while (block) {
if (block->magic_n != MEM_BLOCK_MAGIC_N) { if (block->magic_n != MEM_BLOCK_MAGIC_N) {
mem_analyze_corruption((byte*)block); mem_analyze_corruption(block);
} }
block = UT_LIST_GET_NEXT(mem_block_list, block); block = UT_LIST_GET_NEXT(mem_block_list, block);
......
...@@ -294,7 +294,7 @@ mem_pool_fill_free_list( ...@@ -294,7 +294,7 @@ mem_pool_fill_free_list(
} }
if (UT_LIST_GET_LEN(pool->free_list[i + 1]) == 0) { if (UT_LIST_GET_LEN(pool->free_list[i + 1]) == 0) {
mem_analyze_corruption((byte*)area); mem_analyze_corruption(area);
ut_error; ut_error;
} }
...@@ -363,7 +363,7 @@ mem_area_alloc( ...@@ -363,7 +363,7 @@ mem_area_alloc(
"InnoDB: element is not marked free!\n", "InnoDB: element is not marked free!\n",
(ulong) n); (ulong) n);
mem_analyze_corruption((byte*)area); mem_analyze_corruption(area);
/* Try to analyze a strange assertion failure reported at /* Try to analyze a strange assertion failure reported at
mysql@lists.mysql.com where the free bit IS 1 in the mysql@lists.mysql.com where the free bit IS 1 in the
...@@ -382,7 +382,7 @@ mem_area_alloc( ...@@ -382,7 +382,7 @@ mem_area_alloc(
"InnoDB: Error: Removing element from mem pool free list %lu\n" "InnoDB: Error: Removing element from mem pool free list %lu\n"
"InnoDB: though the list length is 0!\n", "InnoDB: though the list length is 0!\n",
(ulong) n); (ulong) n);
mem_analyze_corruption((byte*)area); mem_analyze_corruption(area);
ut_error; ut_error;
} }
...@@ -475,7 +475,7 @@ mem_area_free( ...@@ -475,7 +475,7 @@ mem_area_free(
"InnoDB: Error: Freeing element to mem pool free list though the\n" "InnoDB: Error: Freeing element to mem pool free list though the\n"
"InnoDB: element is marked free!\n"); "InnoDB: element is marked free!\n");
mem_analyze_corruption((byte*)area); mem_analyze_corruption(area);
ut_error; ut_error;
} }
...@@ -486,7 +486,7 @@ mem_area_free( ...@@ -486,7 +486,7 @@ mem_area_free(
"InnoDB: Error: Mem area size is 0. Possibly a memory overrun of the\n" "InnoDB: Error: Mem area size is 0. Possibly a memory overrun of the\n"
"InnoDB: previous allocated area!\n"); "InnoDB: previous allocated area!\n");
mem_analyze_corruption((byte*)area); mem_analyze_corruption(area);
ut_error; ut_error;
} }
...@@ -502,7 +502,7 @@ mem_area_free( ...@@ -502,7 +502,7 @@ mem_area_free(
"InnoDB: Error: Memory area size %lu, next area size %lu not a power of 2!\n" "InnoDB: Error: Memory area size %lu, next area size %lu not a power of 2!\n"
"InnoDB: Possibly a memory overrun of the buffer being freed here.\n", "InnoDB: Possibly a memory overrun of the buffer being freed here.\n",
(ulong) size, (ulong) next_size); (ulong) size, (ulong) next_size);
mem_analyze_corruption((byte*)area); mem_analyze_corruption(area);
ut_error; ut_error;
} }
......
...@@ -487,7 +487,7 @@ que_graph_free_recursive( ...@@ -487,7 +487,7 @@ que_graph_free_recursive(
fprintf(stderr, fprintf(stderr,
"que_thr struct appears corrupt; magic n %lu\n", "que_thr struct appears corrupt; magic n %lu\n",
(unsigned long) thr->magic_n); (unsigned long) thr->magic_n);
mem_analyze_corruption((byte*)thr); mem_analyze_corruption(thr);
ut_error; ut_error;
} }
...@@ -599,7 +599,7 @@ que_graph_free_recursive( ...@@ -599,7 +599,7 @@ que_graph_free_recursive(
fprintf(stderr, fprintf(stderr,
"que_node struct appears corrupt; type %lu\n", "que_node struct appears corrupt; type %lu\n",
(unsigned long) que_node_get_type(node)); (unsigned long) que_node_get_type(node));
mem_analyze_corruption((byte*)node); mem_analyze_corruption(node);
ut_error; ut_error;
} }
} }
...@@ -990,7 +990,7 @@ que_thr_move_to_run_state_for_mysql( ...@@ -990,7 +990,7 @@ que_thr_move_to_run_state_for_mysql(
"que_thr struct appears corrupt; magic n %lu\n", "que_thr struct appears corrupt; magic n %lu\n",
(unsigned long) thr->magic_n); (unsigned long) thr->magic_n);
mem_analyze_corruption((byte*)thr); mem_analyze_corruption(thr);
ut_error; ut_error;
} }
...@@ -1027,7 +1027,7 @@ que_thr_stop_for_mysql_no_error( ...@@ -1027,7 +1027,7 @@ que_thr_stop_for_mysql_no_error(
"que_thr struct appears corrupt; magic n %lu\n", "que_thr struct appears corrupt; magic n %lu\n",
(unsigned long) thr->magic_n); (unsigned long) thr->magic_n);
mem_analyze_corruption((byte*)thr); mem_analyze_corruption(thr);
ut_error; ut_error;
} }
......
...@@ -207,7 +207,7 @@ row_mysql_store_blob_ref( ...@@ -207,7 +207,7 @@ row_mysql_store_blob_ref(
mach_write_to_n_little_endian(dest, col_len - 8, len); mach_write_to_n_little_endian(dest, col_len - 8, len);
ut_memcpy(dest + col_len - 8, (byte*)&data, sizeof(byte*)); ut_memcpy(dest + col_len - 8, &data, sizeof(byte*));
} }
/*********************************************************************** /***********************************************************************
...@@ -226,7 +226,7 @@ row_mysql_read_blob_ref( ...@@ -226,7 +226,7 @@ row_mysql_read_blob_ref(
*len = mach_read_from_n_little_endian(ref, col_len - 8); *len = mach_read_from_n_little_endian(ref, col_len - 8);
ut_memcpy((byte*)&data, ref + col_len - 8, sizeof(byte*)); ut_memcpy(&data, ref + col_len - 8, sizeof(byte*));
return(data); return(data);
} }
...@@ -681,7 +681,7 @@ row_prebuilt_free( ...@@ -681,7 +681,7 @@ row_prebuilt_free(
ut_print_name(stderr, NULL, prebuilt->table->name); ut_print_name(stderr, NULL, prebuilt->table->name);
putc('\n', stderr); putc('\n', stderr);
mem_analyze_corruption((byte*)prebuilt); mem_analyze_corruption(prebuilt);
ut_error; ut_error;
} }
...@@ -761,7 +761,7 @@ row_update_prebuilt_trx( ...@@ -761,7 +761,7 @@ row_update_prebuilt_trx(
"InnoDB: trx handle. Magic n %lu\n", "InnoDB: trx handle. Magic n %lu\n",
(ulong) trx->magic_n); (ulong) trx->magic_n);
mem_analyze_corruption((byte*)trx); mem_analyze_corruption(trx);
ut_error; ut_error;
} }
...@@ -774,7 +774,7 @@ row_update_prebuilt_trx( ...@@ -774,7 +774,7 @@ row_update_prebuilt_trx(
ut_print_name(stderr, NULL, prebuilt->table->name); ut_print_name(stderr, NULL, prebuilt->table->name);
putc('\n', stderr); putc('\n', stderr);
mem_analyze_corruption((byte*)prebuilt); mem_analyze_corruption(prebuilt);
ut_error; ut_error;
} }
...@@ -1095,7 +1095,7 @@ row_insert_for_mysql( ...@@ -1095,7 +1095,7 @@ row_insert_for_mysql(
ut_print_name(stderr, prebuilt->trx, prebuilt->table->name); ut_print_name(stderr, prebuilt->trx, prebuilt->table->name);
putc('\n', stderr); putc('\n', stderr);
mem_analyze_corruption((byte*)prebuilt); mem_analyze_corruption(prebuilt);
ut_error; ut_error;
} }
...@@ -1330,7 +1330,7 @@ row_update_for_mysql( ...@@ -1330,7 +1330,7 @@ row_update_for_mysql(
ut_print_name(stderr, prebuilt->trx, prebuilt->table->name); ut_print_name(stderr, prebuilt->trx, prebuilt->table->name);
putc('\n', stderr); putc('\n', stderr);
mem_analyze_corruption((byte*)prebuilt); mem_analyze_corruption(prebuilt);
ut_error; ut_error;
} }
......
...@@ -3161,7 +3161,7 @@ row_search_for_mysql( ...@@ -3161,7 +3161,7 @@ row_search_for_mysql(
ut_print_name(stderr, trx, prebuilt->table->name); ut_print_name(stderr, trx, prebuilt->table->name);
putc('\n', stderr); putc('\n', stderr);
mem_analyze_corruption((byte*)prebuilt); mem_analyze_corruption(prebuilt);
ut_error; ut_error;
} }
......
...@@ -307,7 +307,7 @@ trx_free( ...@@ -307,7 +307,7 @@ trx_free(
trx_print(stderr, trx, 600); trx_print(stderr, trx, 600);
ut_print_buf(stderr, (byte*)trx, sizeof(trx_t)); ut_print_buf(stderr, trx, sizeof(trx_t));
} }
ut_a(trx->magic_n == TRX_MAGIC_N); ut_a(trx->magic_n == TRX_MAGIC_N);
......
...@@ -1443,7 +1443,7 @@ trx_undo_mem_init_for_reuse( ...@@ -1443,7 +1443,7 @@ trx_undo_mem_init_for_reuse(
fprintf(stderr, "InnoDB: Error: undo->id is %lu\n", fprintf(stderr, "InnoDB: Error: undo->id is %lu\n",
(ulong) undo->id); (ulong) undo->id);
mem_analyze_corruption((byte*)undo); mem_analyze_corruption(undo);
ut_error; ut_error;
} }
...@@ -1589,7 +1589,7 @@ trx_undo_reuse_cached( ...@@ -1589,7 +1589,7 @@ trx_undo_reuse_cached(
if (undo->id >= TRX_RSEG_N_SLOTS) { if (undo->id >= TRX_RSEG_N_SLOTS) {
fprintf(stderr, "InnoDB: Error: undo->id is %lu\n", fprintf(stderr, "InnoDB: Error: undo->id is %lu\n",
(ulong) undo->id); (ulong) undo->id);
mem_analyze_corruption((byte*)undo); mem_analyze_corruption(undo);
ut_error; ut_error;
} }
...@@ -1737,7 +1737,7 @@ trx_undo_set_state_at_finish( ...@@ -1737,7 +1737,7 @@ trx_undo_set_state_at_finish(
if (undo->id >= TRX_RSEG_N_SLOTS) { if (undo->id >= TRX_RSEG_N_SLOTS) {
fprintf(stderr, "InnoDB: Error: undo->id is %lu\n", fprintf(stderr, "InnoDB: Error: undo->id is %lu\n",
(ulong) undo->id); (ulong) undo->id);
mem_analyze_corruption((byte*)undo); mem_analyze_corruption(undo);
ut_error; ut_error;
} }
...@@ -1787,7 +1787,7 @@ trx_undo_set_state_at_prepare( ...@@ -1787,7 +1787,7 @@ trx_undo_set_state_at_prepare(
if (undo->id >= TRX_RSEG_N_SLOTS) { if (undo->id >= TRX_RSEG_N_SLOTS) {
fprintf(stderr, "InnoDB: Error: undo->id is %lu\n", fprintf(stderr, "InnoDB: Error: undo->id is %lu\n",
(ulong) undo->id); (ulong) undo->id);
mem_analyze_corruption((byte*)undo); mem_analyze_corruption(undo);
ut_error; ut_error;
} }
......
...@@ -307,7 +307,7 @@ void ...@@ -307,7 +307,7 @@ void
ut_print_buf( ut_print_buf(
/*=========*/ /*=========*/
FILE* file, /* in: file where to print */ FILE* file, /* in: file where to print */
const byte* buf, /* in: memory buffer */ const void* buf, /* in: memory buffer */
ulint len) /* in: length of the buffer */ ulint len) /* in: length of the buffer */
{ {
const byte* data; const byte* data;
...@@ -315,13 +315,13 @@ ut_print_buf( ...@@ -315,13 +315,13 @@ ut_print_buf(
fprintf(file, " len %lu; hex ", len); fprintf(file, " len %lu; hex ", len);
for (data = buf, i = 0; i < len; i++) { for (data = (const byte*)buf, i = 0; i < len; i++) {
fprintf(file, "%02lx", (ulong)*data++); fprintf(file, "%02lx", (ulong)*data++);
} }
fputs("; asc ", file); fputs("; asc ", file);
data = buf; data = (const byte*)buf;
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
int c = (int) *data++; int c = (int) *data++;
......
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