diff options
Diffstat (limited to 'mysys')
45 files changed, 122 insertions, 100 deletions
diff --git a/mysys/array.c b/mysys/array.c index e92c5b45e67..a8c5d181638 100644 --- a/mysys/array.c +++ b/mysys/array.c @@ -22,7 +22,7 @@ Initiate dynamic array SYNOPSIS - my_init_dynamic_array2() + init_dynamic_array2() array Pointer to an array element_size Size of element init_buffer Initial buffer pointer @@ -31,7 +31,7 @@ my_flags Flags to my_malloc DESCRIPTION - my_init_dynamic_array2() initiates array and allocate space for + init_dynamic_array() initiates array and allocate space for init_alloc eilements. Array is usable even if space allocation failed, hence, the function never returns TRUE. @@ -41,11 +41,11 @@ FALSE Ok */ -my_bool my_init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size, +my_bool init_dynamic_array2(DYNAMIC_ARRAY *array, uint element_size, void *init_buffer, uint init_alloc, uint alloc_increment, myf my_flags) { - DBUG_ENTER("my_init_dynamic_array2"); + DBUG_ENTER("init_dynamic_array2"); if (!alloc_increment) { alloc_increment=MY_MAX((8192-MALLOC_OVERHEAD)/element_size,16); diff --git a/mysys/file_logger.c b/mysys/file_logger.c index 4c07b8c7854..da8b5c8d531 100644 --- a/mysys/file_logger.c +++ b/mysys/file_logger.c @@ -16,6 +16,7 @@ #include "my_global.h" #include <my_sys.h> +#include <m_string.h> #include <mysql/service_logger.h> #include <my_pthread.h> diff --git a/mysys/hash.c b/mysys/hash.c index 25210d3fcfe..4ef731cde15 100644 --- a/mysys/hash.c +++ b/mysys/hash.c @@ -40,12 +40,12 @@ static void movelink(HASH_LINK *array,uint pos,uint next_link,uint newlink); static int hashcmp(const HASH *hash, HASH_LINK *pos, const uchar *key, size_t length); -static my_hash_value_type calc_hash(const HASH *hash, - const uchar *key, size_t length) +my_hash_value_type my_hash_sort(const CHARSET_INFO *cs, const uchar *key, + size_t length) { - ulong nr1=1, nr2=4; - hash->charset->coll->hash_sort(hash->charset,(uchar*) key,length,&nr1,&nr2); - return (my_hash_value_type)nr1; + ulong nr1= 1, nr2= 4; + cs->coll->hash_sort(cs, (uchar*) key, length, &nr1, &nr2); + return (my_hash_value_type) nr1; } /** @@ -78,6 +78,7 @@ my_bool my_hash_init2(HASH *hash, uint growth_size, CHARSET_INFO *charset, ulong size, size_t key_offset, size_t key_length, my_hash_get_key get_key, + my_hash_function hash_function, void (*free_element)(void*), uint flags) { my_bool res; @@ -89,6 +90,7 @@ my_hash_init2(HASH *hash, uint growth_size, CHARSET_INFO *charset, hash->key_length=key_length; hash->blength=1; hash->get_key=get_key; + hash->hash_function= hash_function ? hash_function : my_hash_sort; hash->free=free_element; hash->flags=flags; hash->charset=charset; @@ -200,7 +202,8 @@ static uint my_hash_rec_mask(const HASH *hash, HASH_LINK *pos, { size_t length; uchar *key= (uchar*) my_hash_key(hash, pos->data, &length, 0); - return my_hash_mask(calc_hash(hash, key, length), buffmax, maxlength); + return my_hash_mask(hash->hash_function(hash->charset, key, length), buffmax, + maxlength); } @@ -214,7 +217,7 @@ my_hash_value_type rec_hashnr(HASH *hash,const uchar *record) { size_t length; uchar *key= (uchar*) my_hash_key(hash, record, &length, 0); - return calc_hash(hash,key,length); + return hash->hash_function(hash->charset, key, length); } @@ -234,12 +237,6 @@ uchar* my_hash_search_using_hash_value(const HASH *hash, key, length, &state); } -my_hash_value_type my_calc_hash(const HASH *hash, - const uchar *key, size_t length) -{ - return calc_hash(hash, key, length ? length : hash->key_length); -} - /* Search after a record based on a key @@ -254,7 +251,8 @@ uchar* my_hash_first(const HASH *hash, const uchar *key, size_t length, uchar *res; if (my_hash_inited(hash)) res= my_hash_first_from_hash_value(hash, - calc_hash(hash, key, length ? length : hash->key_length), + hash->hash_function(hash->charset, key, + length ? length : hash->key_length), key, length, current_record); else res= 0; @@ -644,9 +642,9 @@ my_bool my_hash_update(HASH *hash, uchar *record, uchar *old_key, /* Search after record with key */ - idx= my_hash_mask(calc_hash(hash, old_key, (old_key_length ? - old_key_length : - hash->key_length)), + idx= my_hash_mask(hash->hash_function(hash->charset, old_key, + (old_key_length ? old_key_length : + hash->key_length)), blength, records); new_index= my_hash_mask(rec_hashnr(hash, record), blength, records); if (idx == new_index) diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c index 3c77e5f820a..3b5e05f1b01 100644 --- a/mysys/ma_dyncol.c +++ b/mysys/ma_dyncol.c @@ -117,7 +117,7 @@ my_bool mariadb_dyncol_has_names(DYNAMIC_COLUMN *str) { if (str->length < 1) return FALSE; - return test(str->str[0] & DYNCOL_FLG_NAMES); + return MY_TEST(str->str[0] & DYNCOL_FLG_NAMES); } static enum enum_dyncol_func_result @@ -1616,7 +1616,7 @@ dynamic_new_column_store(DYNAMIC_COLUMN *str, enum enum_dyncol_func_result rc= ER_DYNCOL_RESOURCE; size_t all_headers_size; - if (!(columns_order= malloc(sizeof(void*)*column_count))) + if (column_count && !(columns_order= malloc(sizeof(void*)*column_count))) return ER_DYNCOL_RESOURCE; if (new_str || str->str == 0) { @@ -3959,7 +3959,7 @@ mariadb_dyncol_val_long(longlong *ll, DYNAMIC_COLUMN_VALUE *val) { sign= -1; src++; - } else if (*src == '-') + } else if (*src == '+') src++; while(len && my_isdigit(&my_charset_latin1, *src)) { @@ -4032,7 +4032,7 @@ mariadb_dyncol_val_double(double *dbl, DYNAMIC_COLUMN_VALUE *val) case DYN_COL_STRING: { char *str, *end; - if ((str= malloc(val->x.string.value.length + 1))) + if (!(str= malloc(val->x.string.value.length + 1))) return ER_DYNCOL_RESOURCE; memcpy(str, val->x.string.value.str, val->x.string.value.length); str[val->x.string.value.length]= '\0'; @@ -4317,6 +4317,18 @@ err: } /** + Free arrays allocated by mariadb_dyncol_unpack() + + @param names Where to put names (should be free by user) + @param vals Where to put values (should be free by user) +*/ +void mariadb_dyncol_unpack_free(LEX_STRING *names, DYNAMIC_COLUMN_VALUE *vals) +{ + my_free(names); + my_free(vals); +} + +/** Get not NULL column count @param str The packed string diff --git a/mysys/md5.c.THIS b/mysys/md5.c.THIS index b4c2cb569fb..829eea50d22 100644 --- a/mysys/md5.c.THIS +++ b/mysys/md5.c.THIS @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c index 3fa6ec28f7d..a3cbaff68b0 100644 --- a/mysys/mf_iocache.c +++ b/mysys/mf_iocache.c @@ -179,7 +179,7 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize, DBUG_ASSERT(seek_offset == 0); } else - info->seek_not_done= test(seek_offset != pos); + info->seek_not_done= MY_TEST(seek_offset != pos); } info->disk_writes= 0; @@ -1281,10 +1281,6 @@ read_append_buffer: size_t transfer_len; DBUG_ASSERT(info->append_read_pos <= info->write_pos); - /* - TODO: figure out if the assert below is needed or correct. - */ - DBUG_ASSERT(pos_in_file == info->end_of_file); copy_len=MY_MIN(Count, len_in_buff); memcpy(Buffer, info->append_read_pos, copy_len); info->append_read_pos += copy_len; diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index 1ee71e55b68..d4c4f8c9997 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -1,5 +1,4 @@ -/* - Copyright (c) 2000, 2011, Oracle and/or its affiliates +/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -5651,7 +5650,7 @@ int flush_partitioned_key_cache_blocks(PARTITIONED_KEY_CACHE_CB *keycache, if ((type == FLUSH_KEEP || type == FLUSH_FORCE_WRITE) && !((*dirty_part_map) & ((ulonglong) 1 << i))) continue; - err|= test(flush_simple_key_cache_blocks(partition, file, 0, type)); + err|= MY_TEST(flush_simple_key_cache_blocks(partition, file, 0, type)); } *dirty_part_map= 0; diff --git a/mysys/mf_qsort.c b/mysys/mf_qsort.c index e681ac9cec4..3e91c0ac0b0 100644 --- a/mysys/mf_qsort.c +++ b/mysys/mf_qsort.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000-2002, 2007 MySQL AB + Use is subject to license terms This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/mf_radix.c b/mysys/mf_radix.c index 7ae4ac9211f..11c4ac45a93 100644 --- a/mysys/mf_radix.c +++ b/mysys/mf_radix.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2007 MySQL AB + Use is subject to license terms This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/mf_same.c b/mysys/mf_same.c index b4af4cbf1b6..244dc650d8b 100644 --- a/mysys/mf_same.c +++ b/mysys/mf_same.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2001, 2007 MySQL AB + Use is subject to license terms This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/mf_soundex.c b/mysys/mf_soundex.c index b3718f20b3f..2784d112805 100644 --- a/mysys/mf_soundex.c +++ b/mysys/mf_soundex.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2002, 2004, 2007 MySQL AB + Use is subject to license terms This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/mf_tempdir.c b/mysys/mf_tempdir.c index 4f4513490ea..2fbbedc4e89 100644 --- a/mysys/mf_tempdir.c +++ b/mysys/mf_tempdir.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -43,7 +43,7 @@ my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist) pathlist=getenv("TMP"); #endif if (!pathlist || !pathlist[0]) - pathlist=(char*) DEFAULT_TMPDIR; + pathlist= DEFAULT_TMPDIR; } do { diff --git a/mysys/mf_tempfile.c b/mysys/mf_tempfile.c index 5ff139bc92a..62b3e09747f 100644 --- a/mysys/mf_tempfile.c +++ b/mysys/mf_tempfile.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -111,7 +111,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix, sizeof(prefix_buff)-7),"XXXXXX") - prefix_buff); if (!dir && ! (dir =getenv("TMPDIR"))) - dir=DEFAULT_TMPDIR; + dir= DEFAULT_TMPDIR; if (strlen(dir)+ pfx_len > FN_REFLEN-2) { errno=my_errno= ENAMETOOLONG; diff --git a/mysys/mf_wcomp.c b/mysys/mf_wcomp.c index 74e6fccb5a1..fe64d06f2db 100644 --- a/mysys/mf_wcomp.c +++ b/mysys/mf_wcomp.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2003, 2004 MySQL AB + Use is subject to license terms This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/mulalloc.c b/mysys/mulalloc.c index 2caac6997ee..9384ed744ad 100644 --- a/mysys/mulalloc.c +++ b/mysys/mulalloc.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2002, 2003, 2007 MySQL AB + Use is subject to license terms This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/my_access.c b/mysys/my_access.c index 1b63b827592..68cd01d33e6 100644 --- a/mysys/my_access.c +++ b/mysys/my_access.c @@ -1,5 +1,5 @@ -/* Copyright (C) 2000 MySQL AB - Copyright (c) 2012, Monty Program Ab +/* Copyright (c) 2000, 2012, Oracle and/or its affiliates + Copyright (c) 2012, 2014, SkySQL Ab This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/my_aes.c.THIS b/mysys/my_aes.c.THIS index 5c52a0b1ab5..7074f700413 100644 --- a/mysys/my_aes.c.THIS +++ b/mysys/my_aes.c.THIS @@ -1,4 +1,5 @@ -/* Copyright (C) 2002 MySQL AB +/* Copyright (c) 2002, 2006 MySQL AB + Use is subject to license terms This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c index d61c7e171d0..fc30185eb5a 100644 --- a/mysys/my_alloc.c +++ b/mysys/my_alloc.c @@ -61,7 +61,7 @@ void init_alloc_root(MEM_ROOT *mem_root, size_t block_size, mem_root->free= mem_root->used= mem_root->pre_alloc= 0; mem_root->min_malloc= 32; mem_root->block_size= (block_size - ALLOC_ROOT_MIN_BLOCK_SIZE) & ~1; - if (test(my_flags & MY_THREAD_SPECIFIC)) + if (MY_TEST(my_flags & MY_THREAD_SPECIFIC)) mem_root->block_size|= 1; mem_root->error_handler= 0; diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c index 3105f4b1daf..67c478659b5 100644 --- a/mysys/my_bitmap.c +++ b/mysys/my_bitmap.c @@ -167,10 +167,10 @@ static inline uint get_first_set(my_bitmap_map value, uint word_pos) } -my_bool bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits, - my_bool thread_safe __attribute__((unused))) +my_bool my_bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits, + my_bool thread_safe __attribute__((unused))) { - DBUG_ENTER("bitmap_init"); + DBUG_ENTER("my_bitmap_init"); if (!buf) { uint size_in_bytes= bitmap_buffer_size(n_bits); @@ -202,9 +202,9 @@ my_bool bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits, } -void bitmap_free(MY_BITMAP *map) +void my_bitmap_free(MY_BITMAP *map) { - DBUG_ENTER("bitmap_free"); + DBUG_ENTER("my_bitmap_free"); if (map->bitmap) { if (map->mutex) diff --git a/mysys/my_conio.c b/mysys/my_conio.c index 85ea99196a4..0af5706cace 100644 --- a/mysys/my_conio.c +++ b/mysys/my_conio.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2005, 2007 MySQL AB + Use is subject to license terms This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/my_copy.c b/mysys/my_copy.c index 58cacb9639d..8af572b5518 100644 --- a/mysys/my_copy.c +++ b/mysys/my_copy.c @@ -66,7 +66,7 @@ int my_copy(const char *from, const char *to, myf MyFlags) from_file=to_file= -1; DBUG_ASSERT(!(MyFlags & (MY_FNABP | MY_NABP))); /* for my_read/my_write */ if (MyFlags & MY_HOLD_ORIGINAL_MODES) /* Copy stat if possible */ - new_file_stat= test(my_stat((char*) to, &new_stat_buff, MYF(0))); + new_file_stat= MY_TEST(my_stat((char*) to, &new_stat_buff, MYF(0))); if ((from_file=my_open(from,O_RDONLY | O_SHARE,MyFlags)) >= 0) { diff --git a/mysys/my_crc32.c b/mysys/my_crc32.c index 27800098f12..0981c75755d 100644 --- a/mysys/my_crc32.c +++ b/mysys/my_crc32.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2003 MySQL AB +/* Copyright (c) 2003, 2004 MySQL AB + Use is subject to license terms This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/my_delete.c b/mysys/my_delete.c index c1a821e90c2..e99c7ff5fcb 100644 --- a/mysys/my_delete.c +++ b/mysys/my_delete.c @@ -150,4 +150,4 @@ error: my_osmaperr(last_error); DBUG_RETURN(-1); } -#endif
\ No newline at end of file +#endif diff --git a/mysys/my_div.c b/mysys/my_div.c index 29f04a7a01b..660b87e5ab4 100644 --- a/mysys/my_div.c +++ b/mysys/my_div.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2002, 2004, 2007 MySQL AB + Use is subject to license terms This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/my_error.c b/mysys/my_error.c index 1200385a43d..5d16091e0be 100644 --- a/mysys/my_error.c +++ b/mysys/my_error.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/my_fopen.c b/mysys/my_fopen.c index f1a4d078440..ede434f2c32 100644 --- a/mysys/my_fopen.c +++ b/mysys/my_fopen.c @@ -1,5 +1,5 @@ -/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. - Copyright (c) 1985-2011 Monty Program Ab +/* Copyright (c) 2000, 2012, Oracle and/or its affiliates + Copyright (c) 1985, 2011, Monty Program Ab This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/my_gethwaddr.c b/mysys/my_gethwaddr.c index aa63138b48c..208f2ff902a 100644 --- a/mysys/my_gethwaddr.c +++ b/mysys/my_gethwaddr.c @@ -134,7 +134,7 @@ err: #elif defined(_WIN32) #include <winsock2.h> #include <iphlpapi.h> -#pragma comment(lib, "iphlpapi.lib")
+#pragma comment(lib, "iphlpapi.lib") #define ETHER_ADDR_LEN 6 diff --git a/mysys/my_getpagesize.c b/mysys/my_getpagesize.c index 2c2804dfab8..e1c1fcb168d 100644 --- a/mysys/my_getpagesize.c +++ b/mysys/my_getpagesize.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000-2003 MySQL AB +/* Copyright (c) 2000-2003, 2006 MySQL AB + Use is subject to license terms This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/my_getwd.c b/mysys/my_getwd.c index 79ec58d3c5c..fbdcef88bda 100644 --- a/mysys/my_getwd.c +++ b/mysys/my_getwd.c @@ -157,12 +157,12 @@ int test_if_hard_path(register const char *dir_name) my_bool has_path(const char *name) { - return test(strchr(name, FN_LIBCHAR)) + return MY_TEST(strchr(name, FN_LIBCHAR)) #if FN_LIBCHAR != '/' - || test(strchr(name,'/')) + || MY_TEST(strchr(name, '/')) #endif #ifdef FN_DEVCHAR - || test(strchr(name, FN_DEVCHAR)) + || MY_TEST(strchr(name, FN_DEVCHAR)) #endif ; } diff --git a/mysys/my_libwrap.c b/mysys/my_libwrap.c index dea4bca114e..1cbfa83030b 100644 --- a/mysys/my_libwrap.c +++ b/mysys/my_libwrap.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2003 MySQL AB +/* Copyright (c) 2003, 2006 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/my_lockmem.c b/mysys/my_lockmem.c index 2e036936c70..3e27564f100 100644 --- a/mysys/my_lockmem.c +++ b/mysys/my_lockmem.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/my_malloc.c b/mysys/my_malloc.c index 2f3a5276a59..e533230106e 100644 --- a/mysys/my_malloc.c +++ b/mysys/my_malloc.c @@ -1,6 +1,6 @@ /* - Copyright (c) 2000, 2010, Oracle and/or its affiliates - Copyright (c) 2009, 2013, Monty Program Ab. + Copyright (c) 2000, 2013, Oracle and/or its affiliates + Copyright (c) 2009, 2014, SkySQL Ab This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -112,9 +112,10 @@ void *my_malloc(size_t size, myf my_flags) } else { - MALLOC_STORE_SIZE(point, void*, size, test(my_flags & MY_THREAD_SPECIFIC)); + MALLOC_STORE_SIZE(point, void*, size, + MY_TEST(my_flags & MY_THREAD_SPECIFIC)); update_malloc_size(size + MALLOC_PREFIX_SIZE, - test(my_flags & MY_THREAD_SPECIFIC)); + MY_TEST(my_flags & MY_THREAD_SPECIFIC)); DBUG_EXECUTE_IF("simulate_out_of_memory", { /* my_free() handles memory accounting */ @@ -158,7 +159,7 @@ void *my_realloc(void *oldpoint, size_t size, myf my_flags) Test that the new and old area are the same, if not MY_THREAD_MOVE is given */ - DBUG_ASSERT((test(my_flags & MY_THREAD_SPECIFIC) == old_flags) || + DBUG_ASSERT((MY_TEST(my_flags & MY_THREAD_SPECIFIC) == old_flags) || (my_flags & MY_THREAD_MOVE)); if ((point= sf_realloc(MALLOC_FIX_POINTER_FOR_FREE(oldpoint), size + MALLOC_PREFIX_SIZE, my_flags)) == NULL) @@ -177,13 +178,14 @@ void *my_realloc(void *oldpoint, size_t size, myf my_flags) } else { - MALLOC_STORE_SIZE(point, void*, size, test(my_flags & MY_THREAD_SPECIFIC)); - if (test(my_flags & MY_THREAD_SPECIFIC) != old_flags) + MALLOC_STORE_SIZE(point, void*, size, + MY_TEST(my_flags & MY_THREAD_SPECIFIC)); + if (MY_TEST(my_flags & MY_THREAD_SPECIFIC) != old_flags) { /* memory moved between system and thread specific */ update_malloc_size(-(longlong) old_size - MALLOC_PREFIX_SIZE, old_flags); update_malloc_size((longlong) size + MALLOC_PREFIX_SIZE, - test(my_flags & MY_THREAD_SPECIFIC)); + MY_TEST(my_flags & MY_THREAD_SPECIFIC)); } else update_malloc_size((longlong)size - (longlong)old_size, old_flags); diff --git a/mysys/my_memmem.c b/mysys/my_memmem.c index 5184037ed39..5806c502b2b 100644 --- a/mysys/my_memmem.c +++ b/mysys/my_memmem.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2006, 2007 MySQL AB + Use is subject to license terms This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/my_mkdir.c b/mysys/my_mkdir.c index 0e77180cd75..5e9691f5b91 100644 --- a/mysys/my_mkdir.c +++ b/mysys/my_mkdir.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2001, 2006 MySQL AB + Use is subject to license terms This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/my_once.c b/mysys/my_once.c index b9232db9b2e..dfd5de81ac7 100644 --- a/mysys/my_once.c +++ b/mysys/my_once.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/my_rename.c b/mysys/my_rename.c index 8a9e6eb3dfd..09e7eafa980 100644 --- a/mysys/my_rename.c +++ b/mysys/my_rename.c @@ -27,19 +27,18 @@ int my_rename(const char *from, const char *to, myf MyFlags) DBUG_ENTER("my_rename"); DBUG_PRINT("my",("from %s to %s MyFlags %lu", from, to, MyFlags)); -#if defined(HAVE_RENAME) #if defined(__WIN__) - /* - On windows we can't rename over an existing file: - Remove any conflicting files: - */ - (void) my_delete(to, MYF(0)); -#endif + if (!MoveFileEx(from, to, MOVEFILE_COPY_ALLOWED | + MOVEFILE_REPLACE_EXISTING)) + { + my_osmaperr(GetLastError()); +#elif defined(HAVE_RENAME) if (rename(from,to)) + { #else if (link(from, to) || unlink(from)) -#endif { +#endif my_errno=errno; error = -1; if (MyFlags & (MY_FAE+MY_WME)) diff --git a/mysys/my_symlink2.c b/mysys/my_symlink2.c index e8ac1dedec1..fcaf78ccff6 100644 --- a/mysys/my_symlink2.c +++ b/mysys/my_symlink2.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2001, 2003, 2005-2007 MySQL AB + Use is subject to license terms This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/my_wincond.c b/mysys/my_wincond.c index f88e33e17f3..6674a5d394d 100644 --- a/mysys/my_wincond.c +++ b/mysys/my_wincond.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -289,7 +289,7 @@ int pthread_cond_signal(pthread_cond_t *cond) int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, - struct timespec *abstime) + const struct timespec *abstime) { if (have_native_conditions) { diff --git a/mysys/my_winthread.c b/mysys/my_winthread.c index d7d7817d400..81fd0e7277c 100644 --- a/mysys/my_winthread.c +++ b/mysys/my_winthread.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c index f0447da42f6..5d19647c989 100644 --- a/mysys/safemalloc.c +++ b/mysys/safemalloc.c @@ -209,7 +209,7 @@ size_t sf_malloc_usable_size(void *ptr, my_bool *is_thread_specific) { struct st_irem *irem= (struct st_irem *)ptr - 1; DBUG_ENTER("sf_malloc_usable_size"); - *is_thread_specific= test(irem->flags & MY_THREAD_SPECIFIC); + *is_thread_specific= MY_TEST(irem->flags & MY_THREAD_SPECIFIC); DBUG_PRINT("exit", ("size: %lu flags: %lu", (ulong) irem->datasize, (ulong)irem->flags)); DBUG_RETURN(irem->datasize); diff --git a/mysys/test_dir.c b/mysys/test_dir.c index 0ac559568b1..364562a6972 100644 --- a/mysys/test_dir.c +++ b/mysys/test_dir.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2006 MySQL AB + Use is subject to license terms This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/test_xml.c b/mysys/test_xml.c index e5ff42ab2f5..56b50611498 100644 --- a/mysys/test_xml.c +++ b/mysys/test_xml.c @@ -1,4 +1,5 @@ -/* Copyright (C) 2000 MySQL AB +/* Copyright (c) 2000, 2002 MySQL AB + Use is subject to license terms This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c index 7fd87edda6c..d0bb2f1ef4c 100644 --- a/mysys/thr_alarm.c +++ b/mysys/thr_alarm.c @@ -1,6 +1,5 @@ -/* - Copyright (c) 2000, 2011, Oracle and/or its affiliates - Copyright (c) 2012, Monty Program Ab +/* Copyright (c) 2000, 2013, Oracle and/or its affiliates + Copyright (c) 2012, 2014, SkySQL Ab This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/mysys/thr_mutex.c b/mysys/thr_mutex.c index c70aa342802..18af5f47b10 100644 --- a/mysys/thr_mutex.c +++ b/mysys/thr_mutex.c @@ -174,12 +174,12 @@ static int safe_mutex_lazy_init_deadlock_detection(safe_mutex_t *mp) 128, offsetof(safe_mutex_deadlock_t, id), sizeof(mp->id), - 0, 0, HASH_UNIQUE); + 0, 0, 0, HASH_UNIQUE); my_hash_init2(mp->used_mutex, 64, &my_charset_bin, 128, offsetof(safe_mutex_t, id), sizeof(mp->id), - 0, 0, HASH_UNIQUE); + 0, 0, 0, HASH_UNIQUE); return 0; } diff --git a/mysys/tree.c b/mysys/tree.c index fe2d3f45d57..a9fc542faf6 100644 --- a/mysys/tree.c +++ b/mysys/tree.c @@ -127,7 +127,7 @@ void init_tree(TREE *tree, size_t default_alloc_size, size_t memory_limit, tree->offset_to_key=0; /* use key through pointer */ tree->size_of_element+=sizeof(void*); } - if (!(tree->with_delete= test(my_flags & MY_TREE_WITH_DELETE))) + if (!(tree->with_delete= MY_TEST(my_flags & MY_TREE_WITH_DELETE))) { init_alloc_root(&tree->mem_root, default_alloc_size, 0, MYF(my_flags)); tree->mem_root.min_malloc= sizeof(TREE_ELEMENT)+tree->size_of_element; |