Commit 0229a8e0 authored by Yoni Fogel's avatar Yoni Fogel

Closes #297

toku_malloc/calloc/realloc/memdup now use size_t instead of
nonportable int types.

git-svn-id: file:///svn/tokudb@1823 c7de825b-a66e-492c-adef-691d508d4ae1
parent 4743bd91
......@@ -130,7 +130,7 @@ void do_memory_check (void) {
#endif
void *toku_calloc(long nmemb, long size) {
void *toku_calloc(size_t nmemb, size_t size) {
void *r;
errno=0;
r = actual_calloc(nmemb, size);
......@@ -176,7 +176,7 @@ void *toku_tagmalloc(unsigned long size, int typtag) {
return r;
}
void *toku_realloc(void *p, long size) {
void *toku_realloc(void *p, size_t size) {
void *newp;
note_did_free(p);
errno=0;
......@@ -204,7 +204,7 @@ void toku_free_n(void* p, unsigned long size) {
}
}
void *toku_memdup (const void *v, unsigned int len) {
void *toku_memdup (const void *v, size_t len) {
void *r=toku_malloc(len);
memcpy(r,v,len);
return r;
......
......@@ -3,7 +3,7 @@
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
//#include <stdlib.h>
#include <stdlib.h>
/* Tokutek memory allocation functions and macros.
* These are functions for malloc and free */
......@@ -11,17 +11,17 @@
/* Generally: errno is set to 0 or a value to indicate problems. */
/* Everything should call toku_malloc() instead of malloc(), and toku_calloc() instead of calloc() */
void *toku_calloc(long nmemb, long size);
void *toku_malloc(unsigned long size);
void *toku_calloc(size_t nmemb, size_t size);
void *toku_malloc(size_t size);
/* toku_tagmalloc() performs a malloc(size), but fills in the first 4 bytes with typ.
* This "tag" is useful if you are debugging and run across a void* that is
* really a (struct foo *), and you want to figure out what it is.
*/
void *toku_tagmalloc(unsigned long size, int typ);
void *toku_tagmalloc(size_t size, int typ);
void toku_free(void*);
/* toku_free_n() should be used if the caller knows the size of the malloc'd object. */
void toku_free_n(void*, unsigned long size);
void *toku_realloc(void *, long size);
void toku_free_n(void*, size_t size);
void *toku_realloc(void *, size_t size);
/* MALLOC is a macro that helps avoid a common error:
* Suppose I write
......@@ -54,7 +54,7 @@ void *toku_realloc(void *, long size);
#define TAGMALLOC(t,v) t v = toku_tagmalloc(sizeof(*v), TYP_ ## t);
/* Copy memory. Analogous to strdup() */
void *toku_memdup (const void *v, unsigned int len);
void *toku_memdup (const void *v, size_t len);
/* Toku-version of strdup. Use this so that it calls toku_malloc() */
char *toku_strdup (const char *s);
......
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