git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Decoupling Architectural-specific Code (#35)
[lunaix-os.git]
/
lunaix-os
/
includes
/
lunaix
/
ds
/
hashtable.h
diff --git
a/lunaix-os/includes/lunaix/ds/hashtable.h
b/lunaix-os/includes/lunaix/ds/hashtable.h
index 0e8c691a47ebc1279177ed4559e0411766506243..3a38af895be56444272eeca276bc17f77720d0d3 100644
(file)
--- a/
lunaix-os/includes/lunaix/ds/hashtable.h
+++ b/
lunaix-os/includes/lunaix/ds/hashtable.h
@@
-13,7
+13,7
@@
#ifndef __LUNAIX_HASHTABLE_H
#define __LUNAIX_HASHTABLE_H
#ifndef __LUNAIX_HASHTABLE_H
#define __LUNAIX_HASHTABLE_H
-#include <
lib
/hash.h>
+#include <
klibc
/hash.h>
#include <lunaix/ds/llist.h>
struct hbucket
#include <lunaix/ds/llist.h>
struct hbucket
@@
-21,9
+21,9
@@
struct hbucket
struct hlist_node* head;
};
struct hlist_node* head;
};
-#define __hashkey(table, hash) (
hash
% (sizeof(table) / sizeof(table[0])))
+#define __hashkey(table, hash) (
(hash)
% (sizeof(table) / sizeof(table[0])))
-#define DECLARE_HASHTABLE(name, bucket_num) struct hbucket name[
bucket_num
];
+#define DECLARE_HASHTABLE(name, bucket_num) struct hbucket name[
(bucket_num)
];
#define hashtable_bucket_foreach(bucket, pos, n, member) \
for (pos = list_entry((bucket)->head, typeof(*pos), member); \
#define hashtable_bucket_foreach(bucket, pos, n, member) \
for (pos = list_entry((bucket)->head, typeof(*pos), member); \
@@
-38,7
+38,7
@@
struct hbucket
#define hashtable_init(table) \
{ \
#define hashtable_init(table) \
{ \
- for (
int i = 0; i < (sizeof(table) / sizeof(table[0])); i++) {
\
+ for (
u32_t i = 0; i < (sizeof(table) / sizeof(table[0])); i++) {
\
table[i].head = 0; \
} \
}
table[i].head = 0; \
} \
}