summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assoc.c22
-rw-r--r--items.c24
-rw-r--r--slabs.c2
-rw-r--r--stats.c2
-rw-r--r--thread.c2
5 files changed, 26 insertions, 26 deletions
diff --git a/assoc.c b/assoc.c
index 8997199..259d292 100644
--- a/assoc.c
+++ b/assoc.c
@@ -153,7 +153,7 @@ uint32_t hash(
const uint32_t *k = key; /* read 32-bit chunks */
#ifdef VALGRIND
const uint8_t *k8;
-#endif // ifdef VALGRIND
+#endif /* ifdef VALGRIND */
/*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
while (length > 12)
@@ -331,7 +331,7 @@ uint32_t hash( const void *key, size_t length, const uint32_t initval)
const uint32_t *k = key; /* read 32-bit chunks */
#ifdef VALGRIND
const uint8_t *k8;
-#endif // ifdef VALGRIND
+#endif /* ifdef VALGRIND */
/*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
while (length > 12)
@@ -449,7 +449,7 @@ typedef unsigned long int ub4; /* unsigned 4-byte quantities */
typedef unsigned char ub1; /* unsigned 1-byte quantities */
/* how many powers of 2's worth of buckets we use */
-static int hashpower = 16;
+static unsigned int hashpower = 16;
#define hashsize(n) ((ub4)1<<(n))
#define hashmask(n) (hashsize(n)-1)
@@ -464,16 +464,16 @@ static item** primary_hashtable = 0;
static item** old_hashtable = 0;
/* Number of items in the hash table. */
-static int hash_items = 0;
+static unsigned int hash_items = 0;
/* Flag: Are we in the middle of expanding now? */
-static int expanding = 0;
+static bool expanding = false;
/*
* During expansion we migrate values with bucket granularity; this is how
* far we've gotten so far. Ranges from 0 .. hashsize(hashpower - 1) - 1.
*/
-static int expand_bucket = 0;
+static unsigned int expand_bucket = 0;
void assoc_init(void) {
unsigned int hash_size = hashsize(hashpower) * sizeof(void*);
@@ -488,7 +488,7 @@ void assoc_init(void) {
item *assoc_find(const char *key, const size_t nkey) {
uint32_t hv = hash(key, nkey, 0);
item *it;
- int oldbucket;
+ unsigned int oldbucket;
if (expanding &&
(oldbucket = (hv & hashmask(hashpower - 1))) >= expand_bucket)
@@ -514,7 +514,7 @@ item *assoc_find(const char *key, const size_t nkey) {
static item** _hashitem_before (const char *key, const size_t nkey) {
uint32_t hv = hash(key, nkey, 0);
item **pos;
- int oldbucket;
+ unsigned int oldbucket;
if (expanding &&
(oldbucket = (hv & hashmask(hashpower - 1))) >= expand_bucket)
@@ -539,7 +539,7 @@ static void assoc_expand(void) {
if (settings.verbose > 1)
fprintf(stderr, "Hash table expansion starting\n");
hashpower++;
- expanding = 1;
+ expanding = true;
expand_bucket = 0;
do_assoc_move_next_bucket();
} else {
@@ -566,7 +566,7 @@ void do_assoc_move_next_bucket(void) {
expand_bucket++;
if (expand_bucket == hashsize(hashpower - 1)) {
- expanding = 0;
+ expanding = false;
free(old_hashtable);
if (settings.verbose > 1)
fprintf(stderr, "Hash table expansion done\n");
@@ -577,7 +577,7 @@ void do_assoc_move_next_bucket(void) {
/* Note: this isn't an assoc_update. The key must not already exist to call this */
int assoc_insert(item *it) {
uint32_t hv;
- int oldbucket;
+ unsigned int oldbucket;
assert(assoc_find(ITEM_key(it), it->nkey) == 0); /* shouldn't have duplicately named things defined */
diff --git a/items.c b/items.c
index d4ab8cd..d6c16f4 100644
--- a/items.c
+++ b/items.c
@@ -51,7 +51,7 @@ void item_init(void) {
# define DEBUG_REFCNT(it,op) while(0)
#endif
-/*
+/**
* Generates the variable-sized part of the header for an object.
*
* key - The key
@@ -150,7 +150,7 @@ void item_free(item *it) {
slabs_free(it, ntotal);
}
-/*
+/**
* Returns true if an item will fit in the cache (its size does not exceed
* the maximum for a cache entry.)
*/
@@ -267,12 +267,12 @@ int do_item_replace(item *it, item *new_it) {
/*@null@*/
char *do_item_cachedump(const unsigned int slabs_clsid, const unsigned int limit, unsigned int *bytes) {
- int memlimit = 2 * 1024 * 1024; /* 2MB max response size */
+ unsigned int memlimit = 2 * 1024 * 1024; /* 2MB max response size */
char *buffer;
unsigned int bufcurr;
item *it;
- int len;
- int shown = 0;
+ unsigned int len;
+ unsigned int shown = 0;
char temp[512];
if (slabs_clsid > LARGEST_ID) return NULL;
@@ -332,7 +332,7 @@ char *do_item_stats(int *bytes) {
return buffer;
}
-/* dumps out a list of objects of each size, with granularity of 32 bytes */
+/** dumps out a list of objects of each size, with granularity of 32 bytes */
/*@null@*/
char* do_item_stats_sizes(int *bytes) {
const int num_buckets = 32768; /* max 1MB object, divided into 32 bytes size buckets */
@@ -371,14 +371,14 @@ char* do_item_stats_sizes(int *bytes) {
return buf;
}
-/* returns true if a deleted item's delete-locked-time is over, and it
- should be removed from the namespace */
+/** returns true if a deleted item's delete-locked-time is over, and it
+ should be removed from the namespace */
bool item_delete_lock_over (item *it) {
assert(it->it_flags & ITEM_DELETED);
return (current_time >= it->exptime);
}
-/* wrapper around assoc_find which does the lazy expiration/deletion logic */
+/** wrapper around assoc_find which does the lazy expiration/deletion logic */
item *do_item_get_notedeleted(const char *key, const size_t nkey, bool *delete_locked) {
item *it = assoc_find(key, nkey);
if (delete_locked) *delete_locked = false;
@@ -393,11 +393,11 @@ item *do_item_get_notedeleted(const char *key, const size_t nkey, bool *delete_l
}
if (it != NULL && settings.oldest_live != 0 && settings.oldest_live <= current_time &&
it->time <= settings.oldest_live) {
- do_item_unlink(it); // MTSAFE - cache_lock held
+ do_item_unlink(it); /* MTSAFE - cache_lock held */
it = 0;
}
if (it != NULL && it->exptime != 0 && it->exptime <= current_time) {
- do_item_unlink(it); // MTSAFE - cache_lock held
+ do_item_unlink(it); /* MTSAFE - cache_lock held */
it = 0;
}
@@ -412,7 +412,7 @@ item *item_get(const char *key, const size_t nkey) {
return item_get_notedeleted(key, nkey, 0);
}
-/* returns an item whether or not it's delete-locked or expired. */
+/** returns an item whether or not it's delete-locked or expired. */
item *do_item_get_nocheck(const char *key, const size_t nkey) {
item *it = assoc_find(key, nkey);
if (it) {
diff --git a/slabs.c b/slabs.c
index ec0cd0d..1805129 100644
--- a/slabs.c
+++ b/slabs.c
@@ -88,7 +88,7 @@ unsigned int slabs_clsid(const size_t size) {
return res;
}
-/*
+/**
* Determines the chunk sizes and initializes the slab class descriptors
* accordingly.
*/
diff --git a/stats.c b/stats.c
index 10935d0..3cc3c3e 100644
--- a/stats.c
+++ b/stats.c
@@ -98,7 +98,7 @@ static PREFIX_STATS *stats_prefix_find(const char *key) {
}
strncpy(pfs->prefix, key, length);
- pfs->prefix[length] = '\0'; // because strncpy() sucks
+ pfs->prefix[length] = '\0'; /* because strncpy() sucks */
pfs->prefix_len = length;
pfs->next = prefix_stats[hashval];
diff --git a/thread.c b/thread.c
index 7569c39..6dfa7c2 100644
--- a/thread.c
+++ b/thread.c
@@ -632,7 +632,7 @@ void thread_init(int nthreads, struct event_base *main_base) {
/* Wait for all the threads to set themselves up before returning. */
pthread_mutex_lock(&init_lock);
- init_count++; // main thread
+ init_count++; /* main thread */
while (init_count < nthreads) {
pthread_cond_wait(&init_cond, &init_lock);
}