diff options
author | Mattias Andrée <maandree@operamail.com> | 2015-08-24 17:41:28 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2015-08-24 17:41:28 +0200 |
commit | 935e256c9b5afd43b5bb73fe72111d49d2fbe596 (patch) | |
tree | f5e7aa87c93d6cd8068a4cda67d32b9ca109fb58 | |
parent | style + error messages should include message id + fix buffer overflow (diff) | |
download | mds-935e256c9b5afd43b5bb73fe72111d49d2fbe596.tar.gz mds-935e256c9b5afd43b5bb73fe72111d49d2fbe596.tar.bz2 mds-935e256c9b5afd43b5bb73fe72111d49d2fbe596.tar.xz |
hash-list: style
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/libmdsserver/hash-list.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/libmdsserver/hash-list.h b/src/libmdsserver/hash-list.h index a9ae256..630c130 100644 --- a/src/libmdsserver/hash-list.h +++ b/src/libmdsserver/hash-list.h @@ -376,7 +376,7 @@ T##_remove(T##_t* restrict this, CKEY_T key)\ size_t i = this->last, n, hash = HASH_LIST_HASH(key);\ T##_entry_t* slots = this->slots;\ \ - /* First, try cached index */\ + /* First, try cached index. */\ if (HASH_LIST_EXPECTED(i && (slots[i].key_hash == hash) && (slots[i].key != NULL)))\ if (HASH_LIST_EXPECTED(T##_key_comparer(slots[i].key, key)))\ goto do_remove;\ @@ -385,11 +385,11 @@ T##_remove(T##_t* restrict this, CKEY_T key)\ * what is happening. So we do not expect to get * get to the next line. However, if do not expect to * run get before put or remove, you should modify the - * HASH_LIST_EXPECTED macro. However, this is single + * `HASH_LIST_EXPECTED` macro. However, this is single * case where will will get to the next line, when the * index of the item is zero. */\ \ - /* Then, search */\ + /* Then, search. */\ for (i = 0, n = this->used; i < n; i++)\ if ((slots[i].key_hash == hash) && (slots[i].key != NULL))\ if (T##_key_comparer(slots[i].key, key))\ @@ -422,17 +422,17 @@ T##_put(T##_t* restrict this, KEY_T key, const T##_value_t* restrict value)\ size_t i = this->last, n, empty = this->used, hash;\ T##_entry_t* slots = this->slots;\ \ - /* Remove entry if no value is passed */\ + /* Remove entry if no value is passed. */\ if (value == NULL)\ {\ T##_remove(this, key);\ return 0;\ }\ \ - /* Hash the input key */\ + /* Hash the input key. */\ hash = HASH_LIST_HASH(key);\ \ - /* Try cached index */\ + /* Try cached index. */\ if (HASH_LIST_EXPECTED(i && (slots[i].key != NULL)))\ if (HASH_LIST_EXPECTED(slots[i].key_hash == hash))\ if (HASH_LIST_EXPECTED(T##_key_comparer(slots[i].key, key)))\ @@ -442,11 +442,11 @@ T##_put(T##_t* restrict this, KEY_T key, const T##_value_t* restrict value)\ * what is happening. So we do not expect to get * get to the next line. However, if do not expect to * run get before put or remove, you should modify the - * HASH_LIST_EXPECTED macro. However, this is single + * `HASH_LIST_EXPECTED` macro. However, this is single * case where will will get to the next line, when the * index of the item is zero. */\ \ - /* Find an unused slot or the current slot */\ + /* Find an unused slot or the current slot. */\ for (i = 0, n = this->used; i < n; i++)\ if (slots[i].key == NULL)\ empty = i;\ @@ -454,7 +454,7 @@ T##_put(T##_t* restrict this, KEY_T key, const T##_value_t* restrict value)\ if (T##_key_comparer(slots[i].key, key))\ goto put;\ \ - /* Grow slot allocation is required */\ + /* Grow slot allocation is required. */\ if (empty == this->allocated)\ {\ if (empty >= SIZE_MAX >> 1)\ @@ -466,7 +466,7 @@ T##_put(T##_t* restrict this, KEY_T key, const T##_value_t* restrict value)\ this->allocated <<= 1;\ }\ \ - /* Store entry */\ + /* Store entry. */\ i = empty;\ goto put_no_free;\ put:\ |