Merge branch 'writeback-for-next' of git://git.kernel.org/pub/scm/linux/kernel/git...
[cascardo/linux.git] / security / selinux / ss / hashtab.c
index 24e5ec9..933e735 100644 (file)
@@ -8,9 +8,9 @@
 #include <linux/errno.h>
 #include "hashtab.h"
 
-struct hashtab *hashtab_create(u32 (*hash_value)(struct hashtab *h, void *key),
-                               int (*keycmp)(struct hashtab *h, void *key1, void *key2),
-                               u32 size)
+struct hashtab *hashtab_create(u32 (*hash_value)(struct hashtab *h, const void *key),
+                              int (*keycmp)(struct hashtab *h, const void *key1, const void *key2),
+                              u32 size)
 {
        struct hashtab *p;
        u32 i;
@@ -71,7 +71,7 @@ int hashtab_insert(struct hashtab *h, void *key, void *datum)
        return 0;
 }
 
-void *hashtab_search(struct hashtab *h, void *key)
+void *hashtab_search(struct hashtab *h, const void *key)
 {
        u32 hvalue;
        struct hashtab_node *cur;
@@ -81,7 +81,7 @@ void *hashtab_search(struct hashtab *h, void *key)
 
        hvalue = h->hash_value(h, key);
        cur = h->htable[hvalue];
-       while (cur != NULL && h->keycmp(h, key, cur->key) > 0)
+       while (cur && h->keycmp(h, key, cur->key) > 0)
                cur = cur->next;
 
        if (cur == NULL || (h->keycmp(h, key, cur->key) != 0))
@@ -100,7 +100,7 @@ void hashtab_destroy(struct hashtab *h)
 
        for (i = 0; i < h->size; i++) {
                cur = h->htable[i];
-               while (cur != NULL) {
+               while (cur) {
                        temp = cur;
                        cur = cur->next;
                        kfree(temp);
@@ -127,7 +127,7 @@ int hashtab_map(struct hashtab *h,
 
        for (i = 0; i < h->size; i++) {
                cur = h->htable[i];
-               while (cur != NULL) {
+               while (cur) {
                        ret = apply(cur->key, cur->datum, args);
                        if (ret)
                                return ret;