]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - util.c
Merge branch 'master' into cooking
[xonotic/gmqcc.git] / util.c
diff --git a/util.c b/util.c
index abc102fe4fd33d861d5859ee8ff5c96501bb9836..d695ae62f451e2de25f79c029877294cf17c6599 100644 (file)
--- a/util.c
+++ b/util.c
 #include "gmqcc.h"
 
 /* TODO: remove globals ... */
-uint64_t mem_ab = 0;
-uint64_t mem_db = 0;
-uint64_t mem_at = 0;
-uint64_t mem_dt = 0;
-uint64_t mem_pk = 0;
-uint64_t mem_hw = 0;
+static uint64_t mem_ab = 0;
+static uint64_t mem_db = 0;
+static uint64_t mem_at = 0;
+static uint64_t mem_dt = 0;
+static uint64_t mem_pk = 0;
+static uint64_t mem_hw = 0;
 
 struct memblock_t {
     const char  *file;
@@ -465,8 +465,7 @@ GMQCC_INLINE size_t util_hthash(hash_table_t *ht, const char *key) {
     const unsigned char *data  = (const unsigned char*)key;
 
     while (size >= 4) {
-        alias = *(uint32_t*)data;
-
+        alias  = (data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24));
         alias *= mix;
         alias ^= alias >> rot;
         alias *= mix;
@@ -492,7 +491,7 @@ GMQCC_INLINE size_t util_hthash(hash_table_t *ht, const char *key) {
     return (size_t) (hash % ht->size);
 }
 
-hash_node_t *_util_htnewpair(const char *key, void *value) {
+static hash_node_t *_util_htnewpair(const char *key, void *value) {
     hash_node_t *node;
     if (!(node = (hash_node_t*)mem_a(sizeof(hash_node_t))))
         return NULL;