aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmdsserver
diff options
context:
space:
mode:
Diffstat (limited to 'src/libmdsserver')
-rw-r--r--src/libmdsserver/hash-table.c18
-rw-r--r--src/libmdsserver/linked-list.c16
2 files changed, 17 insertions, 17 deletions
diff --git a/src/libmdsserver/hash-table.c b/src/libmdsserver/hash-table.c
index 923c2a9..3468811 100644
--- a/src/libmdsserver/hash-table.c
+++ b/src/libmdsserver/hash-table.c
@@ -174,7 +174,7 @@ void hash_table_destroy(hash_table_t* restrict this, free_func* key_freer, free_
int hash_table_contains_value(const hash_table_t* restrict this, size_t value)
{
size_t i = this->capacity;
- hash_entry_t* bucket;
+ hash_entry_t* restrict bucket;
while (i)
{
@@ -204,7 +204,7 @@ int hash_table_contains_key(const hash_table_t* restrict this, size_t key)
{
size_t key_hash = hash(this, key);
size_t index = truncate_hash(this, key_hash);
- hash_entry_t* bucket = this->buckets[index];
+ hash_entry_t* restrict bucket = this->buckets[index];
while (bucket)
{
@@ -228,7 +228,7 @@ size_t hash_table_get(const hash_table_t* restrict this, size_t key)
{
size_t key_hash = hash(this, key);
size_t index = truncate_hash(this, key_hash);
- hash_entry_t* bucket = this->buckets[index];
+ hash_entry_t* restrict bucket = this->buckets[index];
while (bucket)
{
@@ -253,7 +253,7 @@ size_t hash_table_put(hash_table_t* restrict this, size_t key, size_t value)
{
size_t key_hash = hash(this, key);
size_t index = truncate_hash(this, key_hash);
- hash_entry_t* bucket = *(this->buckets + index);
+ hash_entry_t* restrict bucket = this->buckets[index];
size_t rc;
while (bucket)
@@ -294,7 +294,7 @@ size_t hash_table_remove(hash_table_t* restrict this, size_t key)
{
size_t key_hash = hash(this, key);
size_t index = truncate_hash(this, key_hash);
- hash_entry_t* bucket = *(this->buckets + index);
+ hash_entry_t* bucket = this->buckets[index];
hash_entry_t* last = NULL;
size_t rc;
@@ -367,7 +367,7 @@ size_t hash_table_marshal_size(const hash_table_t* restrict this)
for (i = 0; i < n; i++)
{
- hash_entry_t* bucket = this->buckets[i];
+ hash_entry_t* restrict bucket = this->buckets[i];
while (bucket != NULL)
{
bucket = bucket->next;
@@ -399,7 +399,7 @@ void hash_table_marshal(const hash_table_t* restrict this, char* restrict data)
for (i = 0; i < n; i++)
{
- hash_entry_t* bucket = this->buckets[i];
+ hash_entry_t* restrict bucket = this->buckets[i];
size_t m = 0;
while (bucket != NULL)
{
@@ -446,11 +446,11 @@ int hash_table_unmarshal(hash_table_t* restrict this, char* restrict data)
for (i = 0; i < n; i++)
{
size_t m = ((size_t*)data)[0];
- hash_entry_t* bucket;
+ hash_entry_t* restrict bucket;
data += 1 * sizeof(size_t) / sizeof(char);
this->buckets[i] = bucket = malloc(sizeof(hash_entry_t));
- if (this->buckets[i] == NULL)
+ if (bucket == NULL)
return -1;
while (m--)
diff --git a/src/libmdsserver/linked-list.c b/src/libmdsserver/linked-list.c
index 4cc70b6..0d9f9f0 100644
--- a/src/libmdsserver/linked-list.c
+++ b/src/libmdsserver/linked-list.c
@@ -120,10 +120,10 @@ void linked_list_destroy(linked_list_t* restrict this)
int linked_list_clone(const linked_list_t* restrict this, linked_list_t* restrict out)
{
size_t n = this->capacity * sizeof(ssize_t);
- size_t* new_values;
- ssize_t* new_next;
- ssize_t* new_previous;
- ssize_t* new_reusable;
+ size_t* restrict new_values;
+ ssize_t* restrict new_next;
+ ssize_t* restrict new_previous;
+ ssize_t* restrict new_reusable;
out->values = NULL;
out->next = NULL;
@@ -191,7 +191,7 @@ int linked_list_pack(linked_list_t* restrict this)
ssize_t head = 0;
size_t i = 0;
ssize_t node;
- size_t* vals;
+ size_t* restrict vals;
vals = malloc(cap * sizeof(size_t));
if (vals == NULL)
@@ -207,9 +207,9 @@ int linked_list_pack(linked_list_t* restrict this)
if (cap != this->capacity)
{
- ssize_t* new_next;
- ssize_t* new_previous;
- ssize_t* new_reusable;
+ ssize_t* restrict new_next;
+ ssize_t* restrict new_previous;
+ ssize_t* restrict new_reusable;
new_next = malloc(cap * sizeof(ssize_t));
if (new_next == NULL)