mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-22 14:11:27 +00:00
move func defs to avoid implicit declaration compiler warning
This commit is contained in:
parent
91cde721b4
commit
09665805e8
1 changed files with 47 additions and 47 deletions
|
@ -145,6 +145,53 @@ hashindex_resize(HashIndex *index, int capacity)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int get_lower_limit(int num_buckets){
|
||||
int min_buckets = hash_sizes[0];
|
||||
if (num_buckets <= min_buckets)
|
||||
return 0;
|
||||
return (int)(num_buckets * HASH_MIN_LOAD);
|
||||
}
|
||||
|
||||
int get_upper_limit(int num_buckets){
|
||||
int max_buckets = hash_sizes[NELEMS(hash_sizes) - 1];
|
||||
if (num_buckets >= max_buckets)
|
||||
return max_buckets;
|
||||
return (int)(num_buckets * HASH_MAX_LOAD);
|
||||
}
|
||||
|
||||
int size_idx(int size){
|
||||
/* find the hash_sizes index with entry >= size */
|
||||
int elems = NELEMS(hash_sizes);
|
||||
int entry, i=0;
|
||||
do{
|
||||
entry = hash_sizes[i++];
|
||||
}while((entry < size) && (i < elems));
|
||||
if (i >= elems)
|
||||
return elems - 1;
|
||||
i--;
|
||||
return i;
|
||||
}
|
||||
|
||||
int fit_size(int current){
|
||||
int i = size_idx(current);
|
||||
return hash_sizes[i];
|
||||
}
|
||||
|
||||
int grow_size(int current){
|
||||
int i = size_idx(current) + 1;
|
||||
int elems = NELEMS(hash_sizes);
|
||||
if (i >= elems)
|
||||
return hash_sizes[elems - 1];
|
||||
return hash_sizes[i];
|
||||
}
|
||||
|
||||
int shrink_size(int current){
|
||||
int i = size_idx(current) - 1;
|
||||
if (i < 0)
|
||||
return hash_sizes[0];
|
||||
return hash_sizes[i];
|
||||
}
|
||||
|
||||
/* Public API */
|
||||
static HashIndex *
|
||||
hashindex_read(const char *path)
|
||||
|
@ -231,53 +278,6 @@ fail:
|
|||
return index;
|
||||
}
|
||||
|
||||
int get_lower_limit(int num_buckets){
|
||||
int min_buckets = hash_sizes[0];
|
||||
if (num_buckets <= min_buckets)
|
||||
return 0;
|
||||
return (int)(num_buckets * HASH_MIN_LOAD);
|
||||
}
|
||||
|
||||
int get_upper_limit(int num_buckets){
|
||||
int max_buckets = hash_sizes[NELEMS(hash_sizes) - 1];
|
||||
if (num_buckets >= max_buckets)
|
||||
return max_buckets;
|
||||
return (int)(num_buckets * HASH_MAX_LOAD);
|
||||
}
|
||||
|
||||
int size_idx(int size){
|
||||
/* find the hash_sizes index with entry >= size */
|
||||
int elems = NELEMS(hash_sizes);
|
||||
int entry, i=0;
|
||||
do{
|
||||
entry = hash_sizes[i++];
|
||||
}while((entry < size) && (i < elems));
|
||||
if (i >= elems)
|
||||
return elems - 1;
|
||||
i--;
|
||||
return i;
|
||||
}
|
||||
|
||||
int fit_size(int current){
|
||||
int i = size_idx(current);
|
||||
return hash_sizes[i];
|
||||
}
|
||||
|
||||
int grow_size(int current){
|
||||
int i = size_idx(current) + 1;
|
||||
int elems = NELEMS(hash_sizes);
|
||||
if (i >= elems)
|
||||
return hash_sizes[elems - 1];
|
||||
return hash_sizes[i];
|
||||
}
|
||||
|
||||
int shrink_size(int current){
|
||||
int i = size_idx(current) - 1;
|
||||
if (i < 0)
|
||||
return hash_sizes[0];
|
||||
return hash_sizes[i];
|
||||
}
|
||||
|
||||
static HashIndex *
|
||||
hashindex_init(int capacity, int key_size, int value_size)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue