Skip to contentSkip to conversation

Ver 2 Introduce symtab_datum_t

PATCH In review Karl MacMillan 2 participants 2 messages Aug 2, 2006 – Aug 3, 2006 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 Ver 2 Introduce symtab_datum_t

This patch cleans up two casts in module_compiler.c to use the new symtab_datum_t.

Karl

---
 checkpolicy/module_compiler.c |   26 +++++++++-----------------
 1 files changed, 9 insertions(+), 17 deletions(-)
checkpolicy/module_compiler.c +9 -17
index ec5fc89..977daca 100644
@@ -137,15 +137,11 @@ int declare_symbol(uint32_t symbol_type,
 	retval = symtab_insert(policydbp, symbol_type, key, datum,
 			       SCOPE_DECL, decl->decl_id, dest_value);
 	if (retval == 1) {
-		/* because C has no polymorphism, make the
-		 * [outrageous] assumption that the first field of all
-		 * symbol table data is a uint32_t representing its
-		 * value */
-		uint32_t *v =
-		    (uint32_t *) hashtab_search(policydbp->symtab[symbol_type].
+		symtab_datum_t *s =
+		    (symtab_datum_t *)hashtab_search(policydbp->symtab[symbol_type].
 						table, key);
-		assert(v != NULL);
-		*dest_value = *v;
+		assert(s != NULL);
+		*dest_value = s->value;
 	} else if (retval == -2) {
 		return -2;
 	} else if (retval < 0) {
@@ -494,15 +490,11 @@ int require_symbol(uint32_t symbol_type,
 	retval = symtab_insert(policydbp, symbol_type, key, datum,
 			       SCOPE_REQ, decl->decl_id, dest_value);
 	if (retval == 1) {
-		/* because C has no polymorphism, make the
-		 * [outrageous] assumption that the first field of all
-		 * symbol table data is a uint32_t representing its
-		 * value */
-		uint32_t *v =
-		    (uint32_t *) hashtab_search(policydbp->symtab[symbol_type].
-						table, key);
-		assert(v != NULL);
-		*dest_value = *v;
+		symtab_datum_t *s =
+		    (symtab_datum_t *) hashtab_search(policydbp->symtab[symbol_type].
+						      table, key);
+		assert(s != NULL);
+		*dest_value = s->value;
 	} else if (retval == -2) {
 		/* ignore require statements if that symbol was
 		 * previously declared and is in current scope */
Signature · 8 lines
1.4.1



--
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.
#1 lore raw
Quoted 2 lines · Karl MacMillan

This patch cleans up two casts in module_compiler.c to use the new symtab_datum_t.

Thanks, merged.

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.