aboutsummaryrefslogtreecommitdiff
path: root/lib/hash.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2007-11-07 09:21:35 +0000
committerDaniel Stenberg <daniel@haxx.se>2007-11-07 09:21:35 +0000
commitcbd1a77ec24e397d05f20c6de106625676343c9d (patch)
treeb92440210b287a25e34293646d26fe124581c767 /lib/hash.c
parent33f7ac06c3aaecf995360323d6f425e769e6fa79 (diff)
if () => if()
while () => while() and some other minor re-indentings
Diffstat (limited to 'lib/hash.c')
-rw-r--r--lib/hash.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/hash.c b/lib/hash.c
index 69437bf48..8496803bb 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -39,7 +39,7 @@ hash_element_dtor(void *user, void *element)
struct curl_hash *h = (struct curl_hash *) user;
struct curl_hash_element *e = (struct curl_hash_element *) element;
- if (e->key)
+ if(e->key)
free(e->key);
h->dtor(e->ptr);
@@ -57,7 +57,7 @@ Curl_hash_init(struct curl_hash *h,
{
int i;
- if (!slots || !hfunc || !comparator ||!dtor) {
+ if(!slots || !hfunc || !comparator ||!dtor) {
return 1; /* failure */
}
@@ -92,12 +92,12 @@ Curl_hash_alloc(int slots,
{
struct curl_hash *h;
- if (!slots || !hfunc || !comparator ||!dtor) {
+ if(!slots || !hfunc || !comparator ||!dtor) {
return NULL; /* failure */
}
h = (struct curl_hash *) malloc(sizeof(struct curl_hash));
- if (h) {
+ if(h) {
if(Curl_hash_init(h, slots, hfunc, comparator, dtor)) {
/* failure */
free(h);
@@ -148,14 +148,14 @@ Curl_hash_add(struct curl_hash *h, void *key, size_t key_len, void *p)
for (le = l->head; le; le = le->next) {
he = (struct curl_hash_element *) le->ptr;
- if (h->comp_func(he->key, he->key_len, key, key_len)) {
+ if(h->comp_func(he->key, he->key_len, key, key_len)) {
h->dtor(p); /* remove the NEW entry */
return he->ptr; /* return the EXISTING entry */
}
}
he = mk_hash_element(key, key_len, p);
- if (he) {
+ if(he) {
if(Curl_llist_insert_next(l, l->tail, he)) {
++h->size;
return p; /* return the new entry */
@@ -182,7 +182,7 @@ int Curl_hash_delete(struct curl_hash *h, void *key, size_t key_len)
for (le = l->head; le; le = le->next) {
he = le->ptr;
- if (h->comp_func(he->key, he->key_len, key, key_len)) {
+ if(h->comp_func(he->key, he->key_len, key, key_len)) {
Curl_llist_remove(l, le, (void *) h);
return 0;
}
@@ -199,7 +199,7 @@ Curl_hash_pick(struct curl_hash *h, void *key, size_t key_len)
for (le = l->head; le; le = le->next) {
he = le->ptr;
- if (h->comp_func(he->key, he->key_len, key, key_len)) {
+ if(h->comp_func(he->key, he->key_len, key, key_len)) {
return he->ptr;
}
}
@@ -254,7 +254,7 @@ Curl_hash_clean_with_criterium(struct curl_hash *h, void *user,
struct curl_hash_element *he = le->ptr;
lnext = le->next;
/* ask the callback function if we shall remove this entry or not */
- if (comp(user, he->ptr)) {
+ if(comp(user, he->ptr)) {
Curl_llist_remove(list, le, (void *) h);
--h->size; /* one less entry in the hash now */
}
@@ -266,7 +266,7 @@ Curl_hash_clean_with_criterium(struct curl_hash *h, void *user,
void
Curl_hash_destroy(struct curl_hash *h)
{
- if (!h)
+ if(!h)
return;
Curl_hash_clean(h);
@@ -279,7 +279,7 @@ size_t Curl_hash_str(void* key, size_t key_length, size_t slots_num)
const char *end = key_str + key_length;
unsigned long h = 5381;
- while (key_str < end) {
+ while(key_str < end) {
h += h << 5;
h ^= (unsigned long) *key_str++;
}
@@ -292,7 +292,7 @@ size_t Curl_str_key_compare(void*k1, size_t key1_len, void*k2, size_t key2_len)
char *key1 = (char *)k1;
char *key2 = (char *)k2;
- if (key1_len == key2_len &&
+ if(key1_len == key2_len &&
*key1 == *key2 &&
memcmp(key1, key2, key1_len) == 0) {
return 1;
@@ -309,7 +309,7 @@ void Curl_hash_print(struct curl_hash *h,
struct curl_llist_element *le;
struct curl_llist *list;
struct curl_hash_element *he;
- if (!h)
+ if(!h)
return;
fprintf(stderr, "=Hash dump=\n");