Skip to content

Commit

Permalink
Whitespace cleanup, to trigger build.
Browse files Browse the repository at this point in the history
  • Loading branch information
gooding470 committed May 4, 2018
1 parent 287a3b0 commit c302133
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions cf/src/rchash.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,13 @@ cf_rchash_fn_u32(const void *key, uint32_t key_size)
return *(const uint32_t *)key;
}


// Hash all bytes of key using 32-bit Fowler-Noll-Vo method.
uint32_t
cf_rchash_fn_fnv32(const void *key, uint32_t key_size)
{
return cf_hash_fnv32((const uint8_t *)key, (size_t)key_size);
}


// Useful if key is a null-terminated string. (Note - if using fixed-size keys,
// key must still be padded to correctly compare keys in a bucket.)
uint32_t
Expand Down Expand Up @@ -163,7 +161,6 @@ cf_rchash_create(cf_rchash_hash_fn h_fn, cf_rchash_destructor_fn d_fn,
return h;
}


void
cf_rchash_destroy(cf_rchash *h)
{
Expand Down Expand Up @@ -193,7 +190,6 @@ cf_rchash_destroy(cf_rchash *h)
cf_free(h);
}


uint32_t
cf_rchash_get_size(const cf_rchash *h)
{
Expand All @@ -203,7 +199,6 @@ cf_rchash_get_size(const cf_rchash *h)
return as_load_uint32(&h->n_elements);
}


// If key is not already in hash, insert it with specified rc_malloc'd object.
// If key is already in hash, replace (and release) existing object.
void
Expand Down Expand Up @@ -259,7 +254,6 @@ cf_rchash_put(cf_rchash *h, const void *key, uint32_t key_size, void *object)
cf_rchash_unlock(l);
}


// Like cf_rchash_put(), but if key is already in hash, fail.
int
cf_rchash_put_unique(cf_rchash *h, const void *key, uint32_t key_size,
Expand Down Expand Up @@ -309,7 +303,6 @@ cf_rchash_put_unique(cf_rchash *h, const void *key, uint32_t key_size,
return CF_RCHASH_OK;
}


// If key is found, object is returned with extra ref-count. When finished with
// it, caller must always release the returned object, and must destroy and free
// the object if the ref-count hits 0 - i.e. caller should do the equivalent of
Expand Down Expand Up @@ -352,7 +345,6 @@ cf_rchash_get(cf_rchash *h, const void *key, uint32_t key_size, void **object_r)
return CF_RCHASH_ERR_NOT_FOUND;
}


// Removes the key and object from the hash, releasing the "original" ref-count.
// If this causes the ref-count to hit 0, the object destructor is called and
// the object is freed.
Expand All @@ -363,7 +355,6 @@ cf_rchash_delete(cf_rchash *h, const void *key, uint32_t key_size)
return cf_rchash_delete_object(h, key, key_size, NULL);
}


// Like cf_rchash_delete() but checks that object found matches that specified.
// Threads may race to delete and release the same object - they may be doing a
// typical get ... delete, release sequence, or a reduce that deletes. While
Expand Down Expand Up @@ -440,7 +431,6 @@ cf_rchash_delete_object(cf_rchash *h, const void *key, uint32_t key_size,
return CF_RCHASH_ERR_NOT_FOUND;
}


// Call the given function (reduce_fn) for every element in the tree.
//
// The value returned by reduce_fn governs behavior as follows:
Expand Down Expand Up @@ -586,7 +576,6 @@ cf_rchash_put_v(cf_rchash *h, const void *key, uint32_t key_size, void *object)
cf_rchash_unlock(l);
}


int
cf_rchash_put_unique_v(cf_rchash *h, const void *key, uint32_t key_size,
void *object)
Expand Down Expand Up @@ -629,7 +618,6 @@ cf_rchash_put_unique_v(cf_rchash *h, const void *key, uint32_t key_size,
return CF_RCHASH_OK;
}


int
cf_rchash_get_v(cf_rchash *h, const void *key, uint32_t key_size,
void **object_r)
Expand Down Expand Up @@ -661,7 +649,6 @@ cf_rchash_get_v(cf_rchash *h, const void *key, uint32_t key_size,
return CF_RCHASH_ERR_NOT_FOUND;
}


int
cf_rchash_delete_object_v(cf_rchash *h, const void *key, uint32_t key_size,
void *object)
Expand Down Expand Up @@ -727,7 +714,6 @@ cf_rchash_delete_object_v(cf_rchash *h, const void *key, uint32_t key_size,
return CF_RCHASH_ERR_NOT_FOUND;
}


int
cf_rchash_reduce_v(cf_rchash *h, cf_rchash_reduce_fn reduce_fn, void *udata)
{
Expand Down Expand Up @@ -836,7 +822,6 @@ cf_rchash_destroy_elements(cf_rchash *h)
}
}


static inline void
cf_rchash_destroy_elements_v(cf_rchash *h)
{
Expand All @@ -862,14 +847,12 @@ cf_rchash_destroy_elements_v(cf_rchash *h)
}
}


static inline uint32_t
cf_rchash_calculate_hash(cf_rchash *h, const void *key, uint32_t key_size)
{
return h->h_fn(key, key_size) % h->n_buckets;
}


static inline pthread_mutex_t *
cf_rchash_lock(cf_rchash *h, uint32_t i)
{
Expand All @@ -889,7 +872,6 @@ cf_rchash_lock(cf_rchash *h, uint32_t i)
return l;
}


static inline void
cf_rchash_unlock(pthread_mutex_t *l)
{
Expand All @@ -898,23 +880,20 @@ cf_rchash_unlock(pthread_mutex_t *l)
}
}


static inline cf_rchash_ele_f *
cf_rchash_get_bucket(cf_rchash *h, uint32_t i)
{
return (cf_rchash_ele_f *)((uint8_t *)h->table +
((sizeof(cf_rchash_ele_f) + h->key_size) * i));
}


static inline cf_rchash_ele_v *
cf_rchash_get_bucket_v(cf_rchash *h, uint32_t i)
{
return (cf_rchash_ele_v *)((uint8_t *)h->table +
(sizeof(cf_rchash_ele_v) * i));
}


static inline void
cf_rchash_fill_element(cf_rchash_ele_f *e, cf_rchash *h, const void *key,
void *object)
Expand All @@ -924,7 +903,6 @@ cf_rchash_fill_element(cf_rchash_ele_f *e, cf_rchash *h, const void *key,
cf_rchash_size_incr(h);
}


static inline void
cf_rchash_fill_element_v(cf_rchash_ele_v *e, cf_rchash *h, const void *key,
uint32_t key_size, void *object)
Expand All @@ -939,23 +917,20 @@ cf_rchash_fill_element_v(cf_rchash_ele_v *e, cf_rchash *h, const void *key,
cf_rchash_size_incr(h);
}


static inline void
cf_rchash_size_incr(cf_rchash *h)
{
// For now, not bothering with different methods per lock mode.
as_incr_int32(&h->n_elements);
}


static inline void
cf_rchash_size_decr(cf_rchash *h)
{
// For now, not bothering with different methods per lock mode.
as_decr_int32(&h->n_elements);
}


static inline void
cf_rchash_release_object(cf_rchash *h, void *object)
{
Expand Down

0 comments on commit c302133

Please sign in to comment.