Skip to contentSkip to conversation

Fix 64bit compilation issue (and remove questionably casting of void* to

PATCH In review Karl MacMillan 2 participants 3 messages Apr 25, 2007 – Apr 26, 2007 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix 64bit compilation issue (and remove questionably casting of void* to

int).

---

 libsepol/tests/test-hashtab.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
libsepol/tests/test-hashtab.c +5 -4
index 0082036..a614e70 100644
@@ -42,13 +42,14 @@ static void test_hashtab_iter(void)
 	struct sepol_iter *iter;
 	int ret, i;
 	char *strings[] = {"foo", "bar", "baz"};
+	int ints[] = {0, 1, 2};
 
 	h = hashtab_create(sepol_symhash, sepol_symcmp, 64);
 	CU_ASSERT(h != NULL);
 	
-	ret = hashtab_insert(h, strings[0], (void *)0);
-	ret = hashtab_insert(h, strings[1], (void *)1);
-	ret = hashtab_insert(h, strings[2], (void *)2);
+	ret = hashtab_insert(h, strings[0], &ints[0]);
+	ret = hashtab_insert(h, strings[1], &ints[1]);
+	ret = hashtab_insert(h, strings[2], &ints[2]);
 
 	ret = sepol_iter_create(NULL, &iter);
 	CU_ASSERT(ret == SEPOL_OK);
@@ -57,7 +58,7 @@ static void test_hashtab_iter(void)
 	while (ret == SEPOL_OK) {
 		cur = (hashtab_ptr_t)sepol_iter_get_data(NULL, iter);
 		CU_ASSERT(cur != NULL);
-		i = (int)cur->datum;
+		i = *(int*)cur->datum;
 		CU_ASSERT(i < 3);
 		CU_ASSERT(strcmp(strings[i], (char *)cur->key) == 0);
 		ret = sepol_iter_next(NULL, iter);

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Karl MacMillan

int).

Merge at will.

Quoted 42 lines

---

 libsepol/tests/test-hashtab.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
libsepol/tests/test-hashtab.c +5 -5
index 0082036..a614e70 100644
@@ -42,13 +42,14 @@ static void test_hashtab_iter(void)
 	struct sepol_iter *iter;
 	int ret, i;
 	char *strings[] = {"foo", "bar", "baz"};
+	int ints[] = {0, 1, 2};
 
 	h = hashtab_create(sepol_symhash, sepol_symcmp, 64);
 	CU_ASSERT(h != NULL);
 
-	ret = hashtab_insert(h, strings[0], (void *)0);
-	ret = hashtab_insert(h, strings[1], (void *)1);
-	ret = hashtab_insert(h, strings[2], (void *)2);
+	ret = hashtab_insert(h, strings[0], &ints[0]);
+	ret = hashtab_insert(h, strings[1], &ints[1]);
+	ret = hashtab_insert(h, strings[2], &ints[2]);
 
 	ret = sepol_iter_create(NULL, &iter);
 	CU_ASSERT(ret == SEPOL_OK);
@@ -57,7 +58,7 @@ static void test_hashtab_iter(void)
 	while (ret == SEPOL_OK) {
 		cur = (hashtab_ptr_t)sepol_iter_get_data(NULL, iter);
 		CU_ASSERT(cur != NULL);
-		i = (int)cur->datum;
+		i = *(int*)cur->datum;
 		CU_ASSERT(i < 3);
 		CU_ASSERT(strcmp(strings[i], (char *)cur->key) == 0);
 		ret = sepol_iter_next(NULL, iter);
 
 
--

This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.