From e69c949fb7183c76aa96ce55900d5314a8a21951 Mon Sep 17 00:00:00 2001
From: "Bradley C. Kuszmaul" <bradley@tokutek.com>
Date: Thu, 29 Nov 2007 15:41:46 +0000
Subject: [PATCH] Rename a bunch of symbols to toku_symbols.  Addresses #8.

git-svn-id: file:///svn/tokudb@827 c7de825b-a66e-492c-adef-691d508d4ae1
---
 newbrt/benchmark-test.c |  2 +-
 newbrt/brt-serialize.c  |  2 +-
 newbrt/memory.c         | 16 ++++++++--------
 newbrt/memory.h         |  8 ++++----
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/newbrt/benchmark-test.c b/newbrt/benchmark-test.c
index c41237b8a4..198b7f763f 100644
--- a/newbrt/benchmark-test.c
+++ b/newbrt/benchmark-test.c
@@ -169,7 +169,7 @@ int main (int argc, char *argv[]) {
     gettimeofday(&t3,0);
     printf("Shutdown %9.6fs\n", tdiff(&t3, &t2));
     printf("Total time %9.6fs for %lld insertions = %8.0f/s\n", tdiff(&t3, &t1), 2*total_n_items, 2*total_n_items/tdiff(&t3, &t1));
-    malloc_report();
+    toku_malloc_report();
     toku_malloc_cleanup();
     return 0;
 }
diff --git a/newbrt/brt-serialize.c b/newbrt/brt-serialize.c
index 3ac5c4d34e..d88ff7ce72 100644
--- a/newbrt/brt-serialize.c
+++ b/newbrt/brt-serialize.c
@@ -549,7 +549,7 @@ int toku_deserialize_brtheader_from (int fd, DISKOFF off, struct brt_header **br
 	    h->roots[i] = rbuf_diskoff(&rc);
 	    rbuf_bytes(&rc, &nameptr, &len);
 	    assert(strlen(nameptr)+1==len);
-	    h->names[i] = memdup(nameptr,len);
+	    h->names[i] = toku_memdup(nameptr,len);
 	}
 	h->unnamed_root = -1;
     } else {
diff --git a/newbrt/memory.c b/newbrt/memory.c
index b30b5eda20..c059fd7ff8 100644
--- a/newbrt/memory.c
+++ b/newbrt/memory.c
@@ -13,7 +13,7 @@ int toku_memory_check=0;
 #define WHEN_MEM_DEBUG(x) ({if (toku_memory_check) ({x});})
 
 
-long long n_items_malloced=0;
+static long long n_items_malloced=0;
 
 /* Memory checking */
 enum { items_limit = 1000 };
@@ -141,9 +141,9 @@ void *toku_calloc(long nmemb, long size) {
 static void *freelist[FREELIST_LIMIT];
 
 #define MALLOC_SIZE_COUNTING_LIMIT 512
-int malloc_counts[MALLOC_SIZE_COUNTING_LIMIT]; // We rely on static variables being initialized to 0.
-int fresh_malloc_counts[MALLOC_SIZE_COUNTING_LIMIT];  // We rely on static variables being initialized to 0.
-int other_malloc_count=0, fresh_other_malloc_count=0;
+static int malloc_counts[MALLOC_SIZE_COUNTING_LIMIT]; // We rely on static variables being initialized to 0.
+static int fresh_malloc_counts[MALLOC_SIZE_COUNTING_LIMIT];  // We rely on static variables being initialized to 0.
+static int other_malloc_count=0, fresh_other_malloc_count=0;
 void *toku_malloc(unsigned long size) {
     void * r;
     errno=0;
@@ -202,13 +202,13 @@ void toku_free_n(void* p, unsigned long size) {
     }
 }
 
-void *memdup (const void *v, unsigned int len) {
+void *toku_memdup (const void *v, unsigned int len) {
     void *r=toku_malloc(len);
     memcpy(r,v,len);
     return r;
 }
 char *toku_strdup (const char *s) {
-    return memdup(s, strlen(s)+1);
+    return toku_memdup(s, strlen(s)+1);
 }
 
 void toku_memory_check_all_free (void) {
@@ -220,7 +220,7 @@ void toku_memory_check_all_free (void) {
     assert(n_items_malloced==0);
 }
 
-int get_n_items_malloced (void) { return n_items_malloced; }
+int toku_get_n_items_malloced (void) { return n_items_malloced; }
 void toku_print_malloced_items (void) {
     int i;
     for (i=0; i<n_items_malloced; i++) {
@@ -228,7 +228,7 @@ void toku_print_malloced_items (void) {
     }
 }
 
-void malloc_report (void) {
+void toku_malloc_report (void) {
     int i;
     printf("malloc report:\n");
     for (i=0; i<MALLOC_SIZE_COUNTING_LIMIT; i++) {
diff --git a/newbrt/memory.h b/newbrt/memory.h
index 262871cca5..92d67a1ac9 100644
--- a/newbrt/memory.h
+++ b/newbrt/memory.h
@@ -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 *memdup (const void *v, unsigned int len);
+void *toku_memdup (const void *v, unsigned int len);
 /* Toku-version of strdup.  Use this so that it calls toku_malloc() */
 char *toku_strdup (const char *s);
 
@@ -63,12 +63,12 @@ void toku_malloc_cleanup (void); /* Before exiting, call this function to free u
 /* Check to see if everything malloc'd was free.  Might be a no-op depending on how memory.c is configured. */
 void toku_memory_check_all_free (void);
 /* Check to see if memory is "sane".  Might be a no-op.  Probably better to simply use valgrind. */
-void do_memory_check(void);
+void toku_do_memory_check(void);
 
 extern int toku_memory_check; // Set to nonzero to get a (much) slower version of malloc that does (much) more checking.
 
-int get_n_items_malloced(void); /* How many items are malloc'd but not free'd.  May return 0 depending on the configuration of memory.c */
+int toku_get_n_items_malloced(void); /* How many items are malloc'd but not free'd.  May return 0 depending on the configuration of memory.c */
 void toku_print_malloced_items(void); /* Try to print some malloced-but-not-freed items.  May be a noop. */
-void malloc_report (void); /* report on statistics about number of mallocs.  Maybe a no-op. */ 
+void toku_malloc_report (void); /* report on statistics about number of mallocs.  Maybe a no-op. */ 
 
 #endif
-- 
2.30.9