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(
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) {
......
......@@ -120,7 +120,7 @@ buf_flush_ready_for_replace(
fprintf(stderr,
" InnoDB: Error: buffer block state %lu in the LRU list!\n",
(ulong)block->state);
ut_print_buf(stderr, (byte*)block, sizeof(buf_block_t));
ut_print_buf(stderr, block, sizeof(buf_block_t));
return(FALSE);
}
......
......@@ -792,7 +792,7 @@ check_trx_exists(
thd->ha_data[innobase_hton.slot] = trx;
} else {
if (trx->magic_n != TRX_MAGIC_N) {
mem_analyze_corruption((byte*)trx);
mem_analyze_corruption(trx);
ut_a(0);
}
......
......@@ -114,7 +114,7 @@ the neighborhood of a given pointer. */
void
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
heaps or buffers. Can only be used in the debug version. */
......
......@@ -202,7 +202,7 @@ void
ut_print_buf(
/*=========*/
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 */
/**************************************************************************
......
......@@ -733,18 +733,18 @@ the neighborhood of a given pointer. */
void
mem_analyze_corruption(
/*===================*/
byte* ptr) /* in: pointer to place of possible corruption */
void* ptr) /* in: pointer to place of possible corruption */
{
byte* p;
ulint i;
ulint dist;
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);
p = ptr;
p = (byte*)ptr;
dist = 0;
for (i = 0; i < 10; i++) {
......@@ -781,7 +781,7 @@ mem_analyze_corruption(
fprintf(stderr,
"InnoDB: Scanning forward trying to find next allocated mem blocks\n");
p = ptr;
p = (byte*)ptr;
dist = 0;
for (i = 0; i < 10; i++) {
......
......@@ -141,7 +141,7 @@ mem_heap_create_block(
|| (type == MEM_HEAP_BUFFER + MEM_HEAP_BTR_SEARCH));
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. */
......@@ -286,7 +286,7 @@ mem_heap_block_free(
ibool init_block;
if (block->magic_n != MEM_BLOCK_MAGIC_N) {
mem_analyze_corruption((byte*)block);
mem_analyze_corruption(block);
}
UT_LIST_REMOVE(list, heap->base, block);
......@@ -361,7 +361,7 @@ mem_validate_all_blocks(void)
while (block) {
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);
......
......@@ -294,7 +294,7 @@ mem_pool_fill_free_list(
}
if (UT_LIST_GET_LEN(pool->free_list[i + 1]) == 0) {
mem_analyze_corruption((byte*)area);
mem_analyze_corruption(area);
ut_error;
}
......@@ -363,7 +363,7 @@ mem_area_alloc(
"InnoDB: element is not marked free!\n",
(ulong) n);
mem_analyze_corruption((byte*)area);
mem_analyze_corruption(area);
/* Try to analyze a strange assertion failure reported at
mysql@lists.mysql.com where the free bit IS 1 in the
......@@ -382,7 +382,7 @@ mem_area_alloc(
"InnoDB: Error: Removing element from mem pool free list %lu\n"
"InnoDB: though the list length is 0!\n",
(ulong) n);
mem_analyze_corruption((byte*)area);
mem_analyze_corruption(area);
ut_error;
}
......@@ -475,7 +475,7 @@ mem_area_free(
"InnoDB: Error: Freeing element to mem pool free list though the\n"
"InnoDB: element is marked free!\n");
mem_analyze_corruption((byte*)area);
mem_analyze_corruption(area);
ut_error;
}
......@@ -486,7 +486,7 @@ mem_area_free(
"InnoDB: Error: Mem area size is 0. Possibly a memory overrun of the\n"
"InnoDB: previous allocated area!\n");
mem_analyze_corruption((byte*)area);
mem_analyze_corruption(area);
ut_error;
}
......@@ -502,7 +502,7 @@ mem_area_free(
"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",
(ulong) size, (ulong) next_size);
mem_analyze_corruption((byte*)area);
mem_analyze_corruption(area);
ut_error;
}
......
......@@ -487,7 +487,7 @@ que_graph_free_recursive(
fprintf(stderr,
"que_thr struct appears corrupt; magic n %lu\n",
(unsigned long) thr->magic_n);
mem_analyze_corruption((byte*)thr);
mem_analyze_corruption(thr);
ut_error;
}
......@@ -599,7 +599,7 @@ que_graph_free_recursive(
fprintf(stderr,
"que_node struct appears corrupt; type %lu\n",
(unsigned long) que_node_get_type(node));
mem_analyze_corruption((byte*)node);
mem_analyze_corruption(node);
ut_error;
}
}
......@@ -990,7 +990,7 @@ que_thr_move_to_run_state_for_mysql(
"que_thr struct appears corrupt; magic n %lu\n",
(unsigned long) thr->magic_n);
mem_analyze_corruption((byte*)thr);
mem_analyze_corruption(thr);
ut_error;
}
......@@ -1027,7 +1027,7 @@ que_thr_stop_for_mysql_no_error(
"que_thr struct appears corrupt; magic n %lu\n",
(unsigned long) thr->magic_n);
mem_analyze_corruption((byte*)thr);
mem_analyze_corruption(thr);
ut_error;
}
......
......@@ -207,7 +207,7 @@ row_mysql_store_blob_ref(
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(
*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);
}
......@@ -681,7 +681,7 @@ row_prebuilt_free(
ut_print_name(stderr, NULL, prebuilt->table->name);
putc('\n', stderr);
mem_analyze_corruption((byte*)prebuilt);
mem_analyze_corruption(prebuilt);
ut_error;
}
......@@ -761,7 +761,7 @@ row_update_prebuilt_trx(
"InnoDB: trx handle. Magic n %lu\n",
(ulong) trx->magic_n);
mem_analyze_corruption((byte*)trx);
mem_analyze_corruption(trx);
ut_error;
}
......@@ -774,7 +774,7 @@ row_update_prebuilt_trx(
ut_print_name(stderr, NULL, prebuilt->table->name);
putc('\n', stderr);
mem_analyze_corruption((byte*)prebuilt);
mem_analyze_corruption(prebuilt);
ut_error;
}
......@@ -1095,7 +1095,7 @@ row_insert_for_mysql(
ut_print_name(stderr, prebuilt->trx, prebuilt->table->name);
putc('\n', stderr);
mem_analyze_corruption((byte*)prebuilt);
mem_analyze_corruption(prebuilt);
ut_error;
}
......@@ -1330,7 +1330,7 @@ row_update_for_mysql(
ut_print_name(stderr, prebuilt->trx, prebuilt->table->name);
putc('\n', stderr);
mem_analyze_corruption((byte*)prebuilt);
mem_analyze_corruption(prebuilt);
ut_error;
}
......
......@@ -3161,7 +3161,7 @@ row_search_for_mysql(
ut_print_name(stderr, trx, prebuilt->table->name);
putc('\n', stderr);
mem_analyze_corruption((byte*)prebuilt);
mem_analyze_corruption(prebuilt);
ut_error;
}
......
......@@ -307,7 +307,7 @@ trx_free(
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);
......
......@@ -1443,7 +1443,7 @@ trx_undo_mem_init_for_reuse(
fprintf(stderr, "InnoDB: Error: undo->id is %lu\n",
(ulong) undo->id);
mem_analyze_corruption((byte*)undo);
mem_analyze_corruption(undo);
ut_error;
}
......@@ -1589,7 +1589,7 @@ trx_undo_reuse_cached(
if (undo->id >= TRX_RSEG_N_SLOTS) {
fprintf(stderr, "InnoDB: Error: undo->id is %lu\n",
(ulong) undo->id);
mem_analyze_corruption((byte*)undo);
mem_analyze_corruption(undo);
ut_error;
}
......@@ -1737,7 +1737,7 @@ trx_undo_set_state_at_finish(
if (undo->id >= TRX_RSEG_N_SLOTS) {
fprintf(stderr, "InnoDB: Error: undo->id is %lu\n",
(ulong) undo->id);
mem_analyze_corruption((byte*)undo);
mem_analyze_corruption(undo);
ut_error;
}
......@@ -1787,7 +1787,7 @@ trx_undo_set_state_at_prepare(
if (undo->id >= TRX_RSEG_N_SLOTS) {
fprintf(stderr, "InnoDB: Error: undo->id is %lu\n",
(ulong) undo->id);
mem_analyze_corruption((byte*)undo);
mem_analyze_corruption(undo);
ut_error;
}
......
......@@ -307,7 +307,7 @@ void
ut_print_buf(
/*=========*/
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 */
{
const byte* data;
......@@ -315,13 +315,13 @@ ut_print_buf(
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++);
}
fputs("; asc ", file);
data = buf;
data = (const byte*)buf;
for (i = 0; i < len; i++) {
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