Fix some errno abuse.
[oweals/opkg-lede.git] / libopkg / hash_table.c
index c98296e2128bcad438cd735c9a90225145803bae..2d42d911f741f4d07cb30e63024d5fe500adcaf2 100644 (file)
@@ -15,7 +15,6 @@
    General Public License for more details.
 */
 
-#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -43,13 +42,13 @@ hash_index(hash_table_t *hash, const char *key)
 /*
  * this is an open table keyed by strings
  */
-int
+void
 hash_table_init(const char *name, hash_table_t *hash, int len)
 {
        if (hash->entries != NULL) {
                fprintf(stderr, "ERROR: %s called on a non empty hash table\n",
                                __FUNCTION__);
-               return -1;
+               return;
        }
 
        memset(hash, 0, sizeof(hash_table_t));
@@ -57,8 +56,6 @@ hash_table_init(const char *name, hash_table_t *hash, int len)
        hash->name = name;
        hash->n_buckets = len;
        hash->entries = xcalloc(hash->n_buckets, sizeof(hash_entry_t));
-
-       return 0;
 }
 
 void
@@ -69,7 +66,7 @@ hash_print_stats(hash_table_t *hash)
                "\tmax_bucket_len=%d, n_used_buckets=%d, ave_bucket_len=%.2f\n"
                "\tn_hits=%d, n_misses=%d\n",
                hash->name,
-               hash->n_buckets*sizeof(hash_entry_t),
+               hash->n_buckets*(int)sizeof(hash_entry_t),
                hash->n_buckets,
                hash->n_elements,
                hash->n_collisions,