diff options
Diffstat (limited to 'sql/uniques.cc')
-rw-r--r-- | sql/uniques.cc | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/sql/uniques.cc b/sql/uniques.cc index 96d1c6bce51..b2a2ef0eeca 100644 --- a/sql/uniques.cc +++ b/sql/uniques.cc @@ -1,4 +1,5 @@ -/* Copyright (c) 2001-2003, 2005-2007 MySQL AB, 2009 Sun Microsystems, Inc. +/* + Copyright (c) 2001-2003, 2005-2007 MySQL AB, 2009 Sun Microsystems, Inc. Use is subject to license terms. This program is free software; you can redistribute it and/or modify @@ -12,7 +13,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ /* Function to handle quick removal of duplicates @@ -35,7 +37,7 @@ #include "sql_sort.h" -int unique_write_to_file(gptr key, element_count count, Unique *unique) +int unique_write_to_file(uchar* key, element_count count, Unique *unique) { /* Use unique->size (size of element stored in the tree) and not @@ -43,11 +45,10 @@ int unique_write_to_file(gptr key, element_count count, Unique *unique) when tree implementation chooses to store pointer to key in TREE_ELEMENT (instead of storing the element itself there) */ - return my_b_write(&unique->file, (byte*) key, - unique->size) ? 1 : 0; + return my_b_write(&unique->file, key, unique->size) ? 1 : 0; } -int unique_write_to_ptrs(gptr key, element_count count, Unique *unique) +int unique_write_to_ptrs(uchar* key, element_count count, Unique *unique) { memcpy(unique->record_pointers, key, unique->size); unique->record_pointers+=unique->size; @@ -331,7 +332,7 @@ bool Unique::flush() if (tree_walk(&tree, (tree_walk_action) unique_write_to_file, (void*) this, left_root_right) || - insert_dynamic(&file_ptrs, (gptr) &file_ptr)) + insert_dynamic(&file_ptrs, (uchar*) &file_ptr)) return 1; delete_tree(&tree); return 0; @@ -370,11 +371,11 @@ Unique::reset() C_MODE_START -static int buffpek_compare(void *arg, byte *key_ptr1, byte *key_ptr2) +static int buffpek_compare(void *arg, uchar *key_ptr1, uchar *key_ptr2) { BUFFPEK_COMPARE_CONTEXT *ctx= (BUFFPEK_COMPARE_CONTEXT *) arg; return ctx->key_compare(ctx->key_compare_arg, - *((byte **) key_ptr1), *((byte **)key_ptr2)); + *((uchar **) key_ptr1), *((uchar **)key_ptr2)); } C_MODE_END @@ -451,7 +452,7 @@ static bool merge_walk(uchar *merge_buffer, ulong merge_buffer_size, if (bytes_read == (uint) (-1)) goto end; DBUG_ASSERT(bytes_read); - queue_insert(&queue, (byte *) top); + queue_insert(&queue, (uchar *) top); } top= (BUFFPEK *) queue_top(&queue); while (queue.elements > 1) @@ -582,7 +583,7 @@ bool Unique::get(TABLE *table) if (my_b_tell(&file) == 0) { /* Whole tree is in memory; Don't use disk if you don't need to */ - if ((record_pointers=table->sort.record_pointers= (byte*) + if ((record_pointers=table->sort.record_pointers= (uchar*) my_malloc(size * tree.elements_in_tree, MYF(0)))) { (void) tree_walk(&tree, (tree_walk_action) unique_write_to_ptrs, @@ -641,7 +642,7 @@ bool Unique::get(TABLE *table) goto err; error=0; err: - x_free((gptr) sort_buffer); + x_free(sort_buffer); if (flush_io_cache(outfile)) error=1; |