summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorkaa@polly.(none) <>2007-10-02 13:34:33 +0400
committerkaa@polly.(none) <>2007-10-02 13:34:33 +0400
commit80a2d47b22dde619656b55831f2a920bfcf8b5b1 (patch)
tree96d09a0fe1bf20227b2718020d527878940fae92 /mysys
parent5a1284ccb2ae763ba22e2da47d45ea6b88c6865e (diff)
parentb794e5f212c7be40ad7be58f7b87319cdcd4c8e3 (diff)
downloadmariadb-git-80a2d47b22dde619656b55831f2a920bfcf8b5b1.tar.gz
Merge polly.(none):/home/kaa/src/maint/bug5731/my50-bug5731
into polly.(none):/home/kaa/src/maint/mysql-5.0-maint
Diffstat (limited to 'mysys')
-rw-r--r--mysys/mf_keycache.c25
-rw-r--r--mysys/my_largepage.c12
-rw-r--r--mysys/my_malloc.c16
-rw-r--r--mysys/safemalloc.c27
4 files changed, 40 insertions, 40 deletions
diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c
index af910678a1f..83363e6960d 100644
--- a/mysys/mf_keycache.c
+++ b/mysys/mf_keycache.c
@@ -301,10 +301,11 @@ static uint next_power(uint value)
*/
int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
- ulong use_mem, uint division_limit,
- uint age_threshold)
+ size_t use_mem, uint division_limit,
+ uint age_threshold)
{
- uint blocks, hash_links, length;
+ ulong blocks, hash_links;
+ size_t length;
int error;
DBUG_ENTER("init_key_cache");
DBUG_ASSERT(key_cache_block_size >= 512);
@@ -332,8 +333,8 @@ int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
DBUG_PRINT("info", ("key_cache_block_size: %u",
key_cache_block_size));
- blocks= (uint) (use_mem / (sizeof(BLOCK_LINK) + 2 * sizeof(HASH_LINK) +
- sizeof(HASH_LINK*) * 5/4 + key_cache_block_size));
+ blocks= (ulong) (use_mem / (sizeof(BLOCK_LINK) + 2 * sizeof(HASH_LINK) +
+ sizeof(HASH_LINK*) * 5/4 + key_cache_block_size));
/* It doesn't make sense to have too few blocks (less than 8) */
if (blocks >= 8 && keycache->disk_blocks < 0)
{
@@ -351,18 +352,18 @@ int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
ALIGN_SIZE(hash_links * sizeof(HASH_LINK)) +
ALIGN_SIZE(sizeof(HASH_LINK*) *
keycache->hash_entries))) +
- ((ulong) blocks * keycache->key_cache_block_size) > use_mem)
+ ((size_t) blocks * keycache->key_cache_block_size) > use_mem)
blocks--;
/* Allocate memory for cache page buffers */
if ((keycache->block_mem=
- my_large_malloc((ulong) blocks * keycache->key_cache_block_size,
- MYF(MY_WME))))
+ my_large_malloc((size_t) blocks * keycache->key_cache_block_size,
+ MYF(MY_WME))))
{
/*
Allocate memory for blocks, hash_links and hash entries;
For each block 2 hash links are allocated
*/
- if ((keycache->block_root= (BLOCK_LINK*) my_malloc((uint) length,
+ if ((keycache->block_root= (BLOCK_LINK*) my_malloc(length,
MYF(0))))
break;
my_large_free(keycache->block_mem, MYF(0));
@@ -375,7 +376,7 @@ int init_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
}
blocks= blocks / 4*3;
}
- keycache->blocks_unused= (ulong) blocks;
+ keycache->blocks_unused= blocks;
keycache->disk_blocks= (int) blocks;
keycache->hash_links= hash_links;
keycache->hash_root= (HASH_LINK**) ((char*) keycache->block_root +
@@ -480,8 +481,8 @@ err:
*/
int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
- ulong use_mem, uint division_limit,
- uint age_threshold)
+ size_t use_mem, uint division_limit,
+ uint age_threshold)
{
int blocks;
struct st_my_thread_var *thread;
diff --git a/mysys/my_largepage.c b/mysys/my_largepage.c
index 9714c582acb..082b6368a64 100644
--- a/mysys/my_largepage.c
+++ b/mysys/my_largepage.c
@@ -26,7 +26,7 @@
#endif
static uint my_get_large_page_size_int(void);
-static gptr my_large_malloc_int(uint size, myf my_flags);
+static gptr my_large_malloc_int(size_t size, myf my_flags);
static my_bool my_large_free_int(gptr ptr, myf my_flags);
/* Gets the size of large pages from the OS */
@@ -48,7 +48,7 @@ uint my_get_large_page_size(void)
my_malloc_lock() in case of failure
*/
-gptr my_large_malloc(uint size, myf my_flags)
+gptr my_large_malloc(size_t size, myf my_flags)
{
gptr ptr;
DBUG_ENTER("my_large_malloc");
@@ -113,7 +113,7 @@ finish:
#if HAVE_DECL_SHM_HUGETLB
/* Linux-specific large pages allocator */
-gptr my_large_malloc_int(uint size, myf my_flags)
+gptr my_large_malloc_int(size_t size, myf my_flags)
{
int shmid;
gptr ptr;
@@ -123,13 +123,13 @@ gptr my_large_malloc_int(uint size, myf my_flags)
/* Align block size to my_large_page_size */
size = ((size - 1) & ~(my_large_page_size - 1)) + my_large_page_size;
- shmid = shmget(IPC_PRIVATE, (size_t)size, SHM_HUGETLB | SHM_R | SHM_W);
+ shmid = shmget(IPC_PRIVATE, size, SHM_HUGETLB | SHM_R | SHM_W);
if (shmid < 0)
{
if (my_flags & MY_WME)
fprintf(stderr,
- "Warning: Failed to allocate %d bytes from HugeTLB memory."
- " errno %d\n", size, errno);
+ "Warning: Failed to allocate %lu bytesx from HugeTLB memory."
+ " errno %d\n", (ulong) size, errno);
DBUG_RETURN(NULL);
}
diff --git a/mysys/my_malloc.c b/mysys/my_malloc.c
index 38d0263b495..256b14a9605 100644
--- a/mysys/my_malloc.c
+++ b/mysys/my_malloc.c
@@ -23,11 +23,11 @@
/* My memory allocator */
-gptr my_malloc(unsigned int size, myf my_flags)
+gptr my_malloc(size_t size, myf my_flags)
{
gptr point;
DBUG_ENTER("my_malloc");
- DBUG_PRINT("my",("size: %u my_flags: %d",size, my_flags));
+ DBUG_PRINT("my",("size: %lu my_flags: %d", (ulong) size, my_flags));
if (!size)
size=1; /* Safety */
@@ -63,11 +63,11 @@ void my_no_flags_free(gptr ptr)
/* malloc and copy */
-gptr my_memdup(const byte *from, uint length, myf my_flags)
+gptr my_memdup(const byte *from, size_t length, myf my_flags)
{
gptr ptr;
if ((ptr=my_malloc(length,my_flags)) != 0)
- memcpy((byte*) ptr, (byte*) from,(size_t) length);
+ memcpy((byte*) ptr, (byte*)from, length);
return(ptr);
}
@@ -75,19 +75,19 @@ gptr my_memdup(const byte *from, uint length, myf my_flags)
char *my_strdup(const char *from, myf my_flags)
{
gptr ptr;
- uint length=(uint) strlen(from)+1;
+ size_t length= strlen(from)+1;
if ((ptr=my_malloc(length,my_flags)) != 0)
- memcpy((byte*) ptr, (byte*) from,(size_t) length);
+ memcpy((byte*) ptr, (byte*) from, length);
return((my_string) ptr);
}
-char *my_strdup_with_length(const char *from, uint length, myf my_flags)
+char *my_strdup_with_length(const char *from, size_t length, myf my_flags)
{
gptr ptr;
if ((ptr=my_malloc(length+1,my_flags)) != 0)
{
- memcpy((byte*) ptr, (byte*) from,(size_t) length);
+ memcpy((byte*) ptr, (byte*) from, length);
((char*) ptr)[length]=0;
}
return((char*) ptr);
diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c
index a7d8f372151..1cdbd1ecbf2 100644
--- a/mysys/safemalloc.c
+++ b/mysys/safemalloc.c
@@ -119,12 +119,12 @@ static int _checkchunk(struct st_irem *pRec, const char *sFile, uint uLine);
/* Allocate some memory. */
-gptr _mymalloc(uint size, const char *filename, uint lineno, myf MyFlags)
+gptr _mymalloc(size_t size, const char *filename, uint lineno, myf MyFlags)
{
struct st_irem *irem;
char *data;
DBUG_ENTER("_mymalloc");
- DBUG_PRINT("enter",("Size: %u",size));
+ DBUG_PRINT("enter",("Size: %lu", (ulong) size));
if (!sf_malloc_quick)
(void) _sanity (filename, lineno);
@@ -151,8 +151,8 @@ gptr _mymalloc(uint size, const char *filename, uint lineno, myf MyFlags)
my_errno=errno;
sprintf(buff,"Out of memory at line %d, '%s'", lineno, filename);
my_message(EE_OUTOFMEMORY, buff, MYF(ME_BELL+ME_WAITTANG+ME_NOREFRESH));
- sprintf(buff,"needed %d byte (%ldk), memory in use: %ld bytes (%ldk)",
- size, (size + 1023L) / 1024L,
+ sprintf(buff,"needed %u byte (%ldk), memory in use: %ld bytes (%ldk)",
+ (uint) size, (uint) (size + 1023L) / 1024L,
sf_malloc_max_memory, (sf_malloc_max_memory + 1023L) / 1024L);
my_message(EE_OUTOFMEMORY, buff, MYF(ME_BELL+ME_WAITTANG+ME_NOREFRESH));
}
@@ -207,8 +207,8 @@ gptr _mymalloc(uint size, const char *filename, uint lineno, myf MyFlags)
Free then old memoryblock
*/
-gptr _myrealloc(register gptr ptr, register uint size,
- const char *filename, uint lineno, myf MyFlags)
+gptr _myrealloc(register gptr ptr, register size_t size,
+ const char *filename, uint lineno, myf MyFlags)
{
struct st_irem *irem;
char *data;
@@ -373,8 +373,7 @@ void TERMINATE(FILE *file)
{
if (file)
{
- fprintf(file, "Warning: Not freed memory segments: %u\n",
- sf_malloc_count);
+ fprintf(file, "Warning: Not freed memory segments: %u\n", sf_malloc_count);
(void) fflush(file);
}
DBUG_PRINT("safe",("sf_malloc_count: %u", sf_malloc_count));
@@ -503,8 +502,8 @@ int _sanity(const char *filename, uint lineno)
/* malloc and copy */
-gptr _my_memdup(const byte *from, uint length, const char *filename,
- uint lineno, myf MyFlags)
+gptr _my_memdup(const byte *from, size_t length, const char *filename,
+ uint lineno, myf MyFlags)
{
gptr ptr;
if ((ptr=_mymalloc(length,filename,lineno,MyFlags)) != 0)
@@ -517,16 +516,16 @@ char *_my_strdup(const char *from, const char *filename, uint lineno,
myf MyFlags)
{
gptr ptr;
- uint length=(uint) strlen(from)+1;
+ size_t length= strlen(from)+1;
if ((ptr=_mymalloc(length,filename,lineno,MyFlags)) != 0)
memcpy((byte*) ptr, (byte*) from,(size_t) length);
return((char*) ptr);
} /* _my_strdup */
-char *_my_strdup_with_length(const char *from, uint length,
- const char *filename, uint lineno,
- myf MyFlags)
+char *_my_strdup_with_length(const char *from, size_t length,
+ const char *filename, uint lineno,
+ myf MyFlags)
{
gptr ptr;
if ((ptr=_mymalloc(length+1,filename,lineno,MyFlags)) != 0)