Commit e6e8a736 authored by Yoni Fogel's avatar Yoni Fogel

Closes #466

All function names that started with __toku_ now start with
toku__
We no longer have function symbols that start with '__'

git-svn-id: file:///svn/tokudb@2623 c7de825b-a66e-492c-adef-691d508d4ae1
parent 4af7f162
......@@ -24,7 +24,7 @@ int toku_env_is_panicked(DB_ENV *dbenv /**< The environment to check */) {
/* Prints an error message to a file specified by env (or stderr),
preceded by the environment's error prefix. */
static void __toku_ydb_error_file(const DB_ENV *env, BOOL use_stderr,
static void toku__ydb_error_file(const DB_ENV *env, BOOL use_stderr,
char errmsg[]) {
/* Determine the error file to use */
FILE *efile=env->i->errfile;
......@@ -80,7 +80,7 @@ void toku_ydb_error_all_cases(const DB_ENV * env,
if (env->i->errcall) env->i->errcall(env, env->i->errpfx, buf);
/* Print out on a file */
__toku_ydb_error_file(env, use_stderr_if_nothing_else, buf);
toku__ydb_error_file(env, use_stderr_if_nothing_else, buf);
}
int toku_ydb_do_error (const DB_ENV *dbenv, int error, const char *string, ...)
......
This diff is collapsed.
......@@ -17,12 +17,12 @@
/* TODO: reallocate the hash table if it grows too big. Perhaps, use toku_get_prime in newbrt/primes.c */
const uint32 __toku_lth_init_size = 521;
static inline uint32 __toku_lth_hash(toku_lth* table, toku_lock_tree* key) {
static inline uint32 toku__lth_hash(toku_lth* table, toku_lock_tree* key) {
size_t tmp = (size_t)key;
return tmp % table->array_size;
}
static inline void __toku_invalidate_scan(toku_lth* table) {
static inline void toku__invalidate_scan(toku_lth* table) {
table->finger_end = TRUE;
}
......@@ -45,7 +45,7 @@ int toku_lth_create(toku_lth** ptable,
tmp->malloc(tmp->array_size * sizeof(*tmp->table));
if (!tmp->table) { r = errno; goto died1; }
memset(tmp->table, 0, tmp->array_size * sizeof(*tmp->table));
__toku_invalidate_scan(tmp);
toku__invalidate_scan(tmp);
*ptable = tmp;
return 0;
}
......@@ -53,7 +53,7 @@ int toku_lth_create(toku_lth** ptable,
toku_lock_tree* toku_lth_find(toku_lth* table, toku_lock_tree* key) {
assert(table && key);
uint32 index = __toku_lth_hash(table, key);
uint32 index = toku__lth_hash(table, key);
toku_lth_elt* element = table->table[index];
while (element && element->key != key) element = element->next;
return element ? element->key : NULL;
......@@ -67,7 +67,7 @@ void toku_lth_start_scan(toku_lth* table) {
table->finger_end = FALSE;
}
static inline toku_lth_elt* __toku_lth_next(toku_lth* table) {
static inline toku_lth_elt* toku__lth_next(toku_lth* table) {
assert(table);
assert(!table->finger_end);
......@@ -84,19 +84,19 @@ static inline toku_lth_elt* __toku_lth_next(toku_lth* table) {
toku_lock_tree* toku_lth_next(toku_lth* table) {
assert(table);
toku_lth_elt* next = __toku_lth_next(table);
toku_lth_elt* next = toku__lth_next(table);
return next ? next->key : NULL;
}
/* Element MUST exist. */
void toku_lth_delete(toku_lth* table, toku_lock_tree* key) {
assert(table && key);
__toku_invalidate_scan(table);
toku__invalidate_scan(table);
/* Must have elements. */
assert(table->num_keys);
uint32 index = __toku_lth_hash(table, key);
uint32 index = toku__lth_hash(table, key);
toku_lth_elt* element = table->table[index];
/* Elements of the right hash must exist. */
......@@ -126,9 +126,9 @@ void toku_lth_delete(toku_lth* table, toku_lock_tree* key) {
/* Will allow you to insert it over and over. You need to keep track. */
int toku_lth_insert(toku_lth* table, toku_lock_tree* key) {
assert(table && key);
__toku_invalidate_scan(table);
toku__invalidate_scan(table);
uint32 index = __toku_lth_hash(table, key);
uint32 index = toku__lth_hash(table, key);
/* Allocate a new one. */
toku_lth_elt* element = (toku_lth_elt*)table->malloc(sizeof(*element));
......@@ -147,10 +147,10 @@ void toku_lth_close(toku_lth* table) {
toku_lth_elt* next = NULL;
toku_lth_start_scan(table);
next = __toku_lth_next(table);
next = toku__lth_next(table);
while (next) {
element = next;
next = __toku_lth_next(table);
next = toku__lth_next(table);
table->free(element);
}
......
......@@ -17,12 +17,12 @@
/* TODO: reallocate the hash table if it grows too big. Perhaps, use toku_get_prime in newbrt/primes.c */
const uint32 __toku_rth_init_size = 521;
static inline uint32 __toku_rth_hash(toku_rth* table, DB_TXN* key) {
static inline uint32 toku__rth_hash(toku_rth* table, DB_TXN* key) {
size_t tmp = (size_t)key;
return tmp % table->array_size;
}
static inline void __toku_invalidate_scan(toku_rth* table) {
static inline void toku__invalidate_scan(toku_rth* table) {
table->finger_end = TRUE;
}
......@@ -45,7 +45,7 @@ int toku_rth_create(toku_rth** ptable,
tmp->malloc(tmp->array_size * sizeof(*tmp->table));
if (!tmp->table) { r = errno; goto died1; }
memset(tmp->table, 0, tmp->array_size * sizeof(*tmp->table));
__toku_invalidate_scan(tmp);
toku__invalidate_scan(tmp);
*ptable = tmp;
return 0;
}
......@@ -53,7 +53,7 @@ int toku_rth_create(toku_rth** ptable,
toku_rt_forest* toku_rth_find(toku_rth* table, DB_TXN* key) {
assert(table && key);
uint32 index = __toku_rth_hash(table, key);
uint32 index = toku__rth_hash(table, key);
toku_rth_elt* element = table->table[index];
while (element && element->value.hash_key != key) element = element->next;
return element ? &element->value : NULL;
......@@ -67,7 +67,7 @@ void toku_rth_start_scan(toku_rth* table) {
table->finger_end = FALSE;
}
static inline toku_rth_elt* __toku_rth_next(toku_rth* table) {
static inline toku_rth_elt* toku__rth_next(toku_rth* table) {
assert(table);
assert(!table->finger_end);
......@@ -84,19 +84,19 @@ static inline toku_rth_elt* __toku_rth_next(toku_rth* table) {
toku_rt_forest* toku_rth_next(toku_rth* table) {
assert(table);
toku_rth_elt* next = __toku_rth_next(table);
toku_rth_elt* next = toku__rth_next(table);
return next ? &next->value : NULL;
}
/* Element MUST exist. */
void toku_rth_delete(toku_rth* table, DB_TXN* key) {
assert(table && key);
__toku_invalidate_scan(table);
toku__invalidate_scan(table);
/* Must have elements. */
assert(table->num_keys);
uint32 index = __toku_rth_hash(table, key);
uint32 index = toku__rth_hash(table, key);
toku_rth_elt* element = table->table[index];
/* Elements of the right hash must exist. */
......@@ -126,9 +126,9 @@ void toku_rth_delete(toku_rth* table, DB_TXN* key) {
/* Will allow you to insert it over and over. You need to keep track. */
int toku_rth_insert(toku_rth* table, DB_TXN* key) {
assert(table && key);
__toku_invalidate_scan(table);
toku__invalidate_scan(table);
uint32 index = __toku_rth_hash(table, key);
uint32 index = toku__rth_hash(table, key);
/* Allocate a new one. */
toku_rth_elt* element = (toku_rth_elt*)table->malloc(sizeof(*element));
......@@ -147,10 +147,10 @@ void toku_rth_close(toku_rth* table) {
toku_rth_elt* next = NULL;
toku_rth_start_scan(table);
next = __toku_rth_next(table);
next = toku__rth_next(table);
while (next) {
element = next;
next = __toku_rth_next(table);
next = toku__rth_next(table);
table->free(element);
}
......
......@@ -109,7 +109,7 @@ DBT *dbt_init(DBT *dbt, void *data, u_int32_t size) {
Parameters are of type toku_point.
Return values conform to cmp from qsort(3).
*/
extern int __toku_lt_point_cmp(void* a, void* b);
extern int toku__lt_point_cmp(void* a, void* b);
void init_point(toku_point* point, toku_lock_tree* tree) {
assert(point && tree);
......
......@@ -2,8 +2,8 @@
#include "test.h"
toku_range_tree* __toku_lt_ifexist_selfwrite(toku_lock_tree* tree, DB_TXN* txn);
toku_range_tree* __toku_lt_ifexist_selfread(toku_lock_tree* tree, DB_TXN* txn);
toku_range_tree* toku__lt_ifexist_selfwrite(toku_lock_tree* tree, DB_TXN* txn);
toku_range_tree* toku__lt_ifexist_selfread(toku_lock_tree* tree, DB_TXN* txn);
int r;
toku_lock_tree* lt = NULL;
......@@ -143,8 +143,8 @@ void lt_find(BOOL dups, toku_range_tree* rt,
}
unsigned i;
for (i = 0; i < numfound; i++) {
if (__toku_lt_point_cmp(buf[i].left, &left ) == 0 &&
__toku_lt_point_cmp(buf[i].right, &right) == 0 &&
if (toku__lt_point_cmp(buf[i].left, &left ) == 0 &&
toku__lt_point_cmp(buf[i].right, &right) == 0 &&
buf[i].data == find_txn) return;
}
assert(FALSE); //Crash since we didn't find it.
......@@ -258,7 +258,7 @@ void runtest(BOOL dups) {
dups ? 3 : 4, 4,
dups ? 3 : 5, 5);
rt = __toku_lt_ifexist_selfread(lt, txn);
rt = toku__lt_ifexist_selfread(lt, txn);
assert(rt);
lt_find(dups, rt, 1,
......@@ -292,7 +292,7 @@ void runtest(BOOL dups) {
3, 3,
dups ? 3 : 7, 7);
rt = __toku_lt_ifexist_selfread(lt, txn); assert(rt);
rt = toku__lt_ifexist_selfread(lt, txn); assert(rt);
lt_find(dups, rt, 1,
3, 3,
......@@ -314,7 +314,7 @@ void runtest(BOOL dups) {
lt_insert(dups, 3, 3, 3, 3);
lt_insert(dups, 4, 4, 4, 4);
lt_insert(dups, 3, 3, 3, 3);
rt = __toku_lt_ifexist_selfread(lt, txn); assert(rt);
rt = toku__lt_ifexist_selfread(lt, txn); assert(rt);
lt_find(dups, rt, 2, 3, 3, 3, 3, txn);
lt_find(dups, rt, 2, 4, 4, 4, 4, txn);
#ifndef TOKU_RT_NOOVERLAPS
......@@ -329,7 +329,7 @@ void runtest(BOOL dups) {
for (i = 0; i < 20; i += 2) {
lt_insert(dups, i, 5, i + 1, 10);
}
rt = __toku_lt_ifexist_selfread(lt, txn);
rt = toku__lt_ifexist_selfread(lt, txn);
assert(rt);
for (i = 0; i < 20; i += 2) {
lt_find(dups, rt, 10, i, 5, i + 1, 10, txn);
......@@ -341,7 +341,7 @@ void runtest(BOOL dups) {
}
#endif
lt_insert(dups, 0, neg_infinite, 20, infinite);
rt = __toku_lt_ifexist_selfread(lt, txn); assert(rt);
rt = toku__lt_ifexist_selfread(lt, txn); assert(rt);
lt_find( dups, rt, 1, 0, neg_infinite, 20, infinite, txn);
#ifndef TOKU_RT_NOOVERLAPS
rt = lt->mainread; assert(rt);
......@@ -357,7 +357,7 @@ void runtest(BOOL dups) {
lt_insert(dups, 4, neg_infinite, 5, infinite);
lt_insert(dups, 3, neg_infinite, 4, infinite);
rt = __toku_lt_ifexist_selfread(lt, txn); assert(rt);
rt = toku__lt_ifexist_selfread(lt, txn); assert(rt);
lt_find(dups, rt, 2, 0, neg_infinite, 2, infinite, txn);
lt_find(dups, rt, 2, 3, neg_infinite, 5, infinite, txn);
#ifndef TOKU_RT_NOOVERLAPS
......@@ -368,7 +368,7 @@ void runtest(BOOL dups) {
lt_insert(dups, 2, neg_infinite, 3, infinite);
rt = __toku_lt_ifexist_selfread(lt, txn); assert(rt);
rt = toku__lt_ifexist_selfread(lt, txn); assert(rt);
lt_find(dups, rt, 1, 0, neg_infinite, 5, infinite, txn);
#ifndef TOKU_RT_NOOVERLAPS
rt = lt->mainread; assert(rt);
......@@ -381,7 +381,7 @@ void runtest(BOOL dups) {
lt_insert(dups, 1, neg_infinite, 3, infinite);
lt_insert(dups, 4, neg_infinite, 6, infinite);
lt_insert(dups, 2, neg_infinite, 5, infinite);
rt = __toku_lt_ifexist_selfread(lt, txn); assert(rt);
rt = toku__lt_ifexist_selfread(lt, txn); assert(rt);
lt_find(dups, rt, 1, 1, neg_infinite, 6, infinite, txn);
#ifndef TOKU_RT_NOOVERLAPS
rt = lt->mainread; assert(rt);
......@@ -394,7 +394,7 @@ void runtest(BOOL dups) {
lt_insert(dups, 4, neg_infinite, 5, infinite);
lt_insert(dups, 6, neg_infinite, 8, infinite);
lt_insert(dups, 2, neg_infinite, 7, infinite);
rt = __toku_lt_ifexist_selfread(lt, txn); assert(rt);
rt = toku__lt_ifexist_selfread(lt, txn); assert(rt);
lt_find(dups, rt, 1, neg_infinite, neg_infinite, 8, infinite, txn);
#ifndef TOKU_RT_NOOVERLAPS
rt = lt->mainread; assert(rt);
......@@ -406,7 +406,7 @@ void runtest(BOOL dups) {
lt_insert(dups, 1, neg_infinite, 2, infinite);
lt_insert(dups, 3, neg_infinite, infinite, infinite);
lt_insert(dups, 2, neg_infinite, 3, infinite);
rt = __toku_lt_ifexist_selfread(lt, txn); assert(rt);
rt = toku__lt_ifexist_selfread(lt, txn); assert(rt);
lt_find(dups, rt, 1, 1, neg_infinite, infinite, infinite, txn);
#ifndef TOKU_RT_NOOVERLAPS
rt = lt->mainread; assert(rt);
......@@ -419,7 +419,7 @@ void runtest(BOOL dups) {
lt_insert(dups, 3, neg_infinite, 4, infinite);
lt_insert(dups, 5, neg_infinite, 6, infinite);
lt_insert(dups, 2, neg_infinite, 5, infinite);
rt = __toku_lt_ifexist_selfread(lt, txn); assert(rt);
rt = toku__lt_ifexist_selfread(lt, txn); assert(rt);
lt_find(dups, rt, 1, 1, neg_infinite, 6, infinite, txn);
#ifndef TOKU_RT_NOOVERLAPS
rt = lt->mainread; assert(rt);
......@@ -431,7 +431,7 @@ void runtest(BOOL dups) {
lt_insert(dups, 1, neg_infinite, 2, infinite);
lt_insert(dups, 3, neg_infinite, 5, infinite);
lt_insert(dups, 2, neg_infinite, 4, infinite);
rt = __toku_lt_ifexist_selfread(lt, txn); assert(rt);
rt = toku__lt_ifexist_selfread(lt, txn); assert(rt);
lt_find(dups, rt, 1, 1, neg_infinite, 5, infinite, txn);
#ifndef TOKU_RT_NOOVERLAPS
rt = lt->mainread; assert(rt);
......
......@@ -2,8 +2,8 @@
#include "test.h"
toku_range_tree* __toku_lt_ifexist_selfwrite(toku_lock_tree* tree, DB_TXN* txn);
toku_range_tree* __toku_lt_ifexist_selfread(toku_lock_tree* tree, DB_TXN* txn);
toku_range_tree* toku__lt_ifexist_selfwrite(toku_lock_tree* tree, DB_TXN* txn);
toku_range_tree* toku__lt_ifexist_selfread(toku_lock_tree* tree, DB_TXN* txn);
int r;
toku_lock_tree* lt = NULL;
......@@ -160,8 +160,8 @@ void lt_find(BOOL dups, toku_range_tree* rt,
}
unsigned i;
for (i = 0; i < numfound; i++) {
if (__toku_lt_point_cmp(buf[i].left, &left ) == 0 &&
__toku_lt_point_cmp(buf[i].right, &right) == 0 &&
if (toku__lt_point_cmp(buf[i].left, &left ) == 0 &&
toku__lt_point_cmp(buf[i].right, &right) == 0 &&
buf[i].data == find_txn) return;
}
assert(FALSE); //Crash since we didn't find it.
......
......@@ -53,14 +53,14 @@ static const u_int32_t minlen = 64;
* < 0: Point strictly less than the range.
* > 0: Point strictly greater than the range.
*/
static int __toku_rt_p_cmp(toku_range_tree* tree,
static int toku__rt_p_cmp(toku_range_tree* tree,
toku_point* point, toku_range* range) {
if (tree->end_cmp(point, range->left) < 0) return -1;
if (tree->end_cmp(point, range->right) > 0) return 1;
return 0;
}
static int __toku_rt_decrease_capacity(toku_range_tree* tree, u_int32_t _num) {
static int toku__rt_decrease_capacity(toku_range_tree* tree, u_int32_t _num) {
//TODO: SOME ATTRIBUTE TO REMOVE NEVER EXECUTABLE ERROR: assert(tree);
u_int32_t num = _num < minlen ? minlen : _num;
......@@ -77,7 +77,7 @@ static int __toku_rt_decrease_capacity(toku_range_tree* tree, u_int32_t _num) {
return 0;
}
static int __toku_rt_increase_capacity(toku_range_tree* tree, u_int32_t num) {
static int toku__rt_increase_capacity(toku_range_tree* tree, u_int32_t num) {
//TODO: SOME ATTRIBUTE TO REMOVE NEVER EXECUTABLE ERROR: assert(tree);
if (tree->ranges_len < num) {
u_int32_t temp_len = tree->ranges_len;
......@@ -91,7 +91,7 @@ static int __toku_rt_increase_capacity(toku_range_tree* tree, u_int32_t num) {
return 0;
}
static int __toku_rt_increase_buffer(toku_range_tree* tree, toku_range** buf,
static int toku__rt_increase_buffer(toku_range_tree* tree, toku_range** buf,
u_int32_t* buflen, u_int32_t num) {
assert(buf);
//TODO: SOME ATTRIBUTE TO REMOVE NEVER EXECUTABLE ERROR: assert(buflen);
......@@ -107,7 +107,7 @@ static int __toku_rt_increase_buffer(toku_range_tree* tree, toku_range** buf,
return 0;
}
static BOOL __toku_rt_overlap(toku_range_tree* tree,
static BOOL toku__rt_overlap(toku_range_tree* tree,
toku_range* a, toku_range* b) {
assert(tree);
assert(a);
......@@ -117,7 +117,7 @@ static BOOL __toku_rt_overlap(toku_range_tree* tree,
tree->end_cmp(b->left, a->right) <= 0);
}
static BOOL __toku_rt_exact(toku_range_tree* tree,
static BOOL toku__rt_exact(toku_range_tree* tree,
toku_range* a, toku_range* b) {
assert(tree);
assert(a);
......@@ -183,8 +183,8 @@ int toku_rt_find(toku_range_tree* tree, toku_range* query, u_int32_t k,
u_int32_t i;
for (i = 0; i < tree->numelements; i++) {
if (__toku_rt_overlap(tree, query, &tree->ranges[i])) {
r = __toku_rt_increase_buffer(tree, buf, buflen, temp_numfound + 1);
if (toku__rt_overlap(tree, query, &tree->ranges[i])) {
r = toku__rt_increase_buffer(tree, buf, buflen, temp_numfound + 1);
if (r != 0) return r;
(*buf)[temp_numfound++] = tree->ranges[i];
//k == 0 means limit of infinity, this is not a bug.
......@@ -204,15 +204,15 @@ int toku_rt_insert(toku_range_tree* tree, toku_range* range) {
//EDOM cases
if (tree->allow_overlaps) {
for (i = 0; i < tree->numelements; i++) {
if (__toku_rt_exact (tree, range, &tree->ranges[i])) return EDOM;
if (toku__rt_exact (tree, range, &tree->ranges[i])) return EDOM;
}
}
else {
for (i = 0; i < tree->numelements; i++) {
if (__toku_rt_overlap(tree, range, &tree->ranges[i])) return EDOM;
if (toku__rt_overlap(tree, range, &tree->ranges[i])) return EDOM;
}
}
r = __toku_rt_increase_capacity(tree, tree->numelements + 1);
r = toku__rt_increase_capacity(tree, tree->numelements + 1);
if (r != 0) return r;
tree->ranges[tree->numelements++] = *range;
return 0;
......@@ -224,14 +224,14 @@ int toku_rt_delete(toku_range_tree* tree, toku_range* range) {
for (i = 0;
i < tree->numelements &&
!__toku_rt_exact(tree, range, &(tree->ranges[i]));
!toku__rt_exact(tree, range, &(tree->ranges[i]));
i++) {}
//EDOM case: Not Found
if (i == tree->numelements) return EDOM;
if (i < tree->numelements - 1) {
tree->ranges[i] = tree->ranges[tree->numelements - 1];
}
__toku_rt_decrease_capacity(tree, --tree->numelements);
toku__rt_decrease_capacity(tree, --tree->numelements);
return 0;
}
......@@ -243,7 +243,7 @@ int toku_rt_predecessor (toku_range_tree* tree, toku_point* point,
u_int32_t i;
for (i = 0; i < tree->numelements; i++) {
if (__toku_rt_p_cmp(tree, point, &tree->ranges[i]) > 0 &&
if (toku__rt_p_cmp(tree, point, &tree->ranges[i]) > 0 &&
(!best || tree->end_cmp(best->left, tree->ranges[i].left) < 0)) {
best = &tree->ranges[i];
}
......@@ -261,7 +261,7 @@ int toku_rt_successor (toku_range_tree* tree, toku_point* point,
u_int32_t i;
for (i = 0; i < tree->numelements; i++) {
if (__toku_rt_p_cmp(tree, point, &tree->ranges[i]) < 0 &&
if (toku__rt_p_cmp(tree, point, &tree->ranges[i]) < 0 &&
(!best || tree->end_cmp(best->left, tree->ranges[i].left) > 0)) {
best = &tree->ranges[i];
}
......
......@@ -505,7 +505,7 @@ static int __attribute__((unused)) locked_env_get_lk_max_locks(DB_ENV *dbenv, u_
toku_ydb_lock(); int r = toku_env_get_lk_max_locks(dbenv, lk_maxp); toku_ydb_unlock(); return r;
}
//void __toku_env_set_noticecall (DB_ENV *env, void (*noticecall)(DB_ENV *, db_notices)) {
//void toku__env_set_noticecall (DB_ENV *env, void (*noticecall)(DB_ENV *, db_notices)) {
// env->i->noticecall = noticecall;
//}
......
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