Skip to contentSkip to conversation

Introduce symtab_datum_t

PATCH In review Karl MacMillan 2 participants 2 messages Jul 31, 2006 – Aug 1, 2006 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 Introduce symtab_datum_t

This patch cleans up a cast in module_compiler.c to use the new symtab_datum_t.

Karl

 module_compiler.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
checkpolicy/module_compiler.c +4 -8
index ec5fc89..3252bb7 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) {

--
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 23 lines · Karl MacMillan

This patch cleans up a cast in module_compiler.c to use the new symtab_datum_t.

Karl

 module_compiler.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
checkpolicy/module_compiler.c +0 -6
index ec5fc89..3252bb7 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].

checkpolicy/module_compiler.c int declare_symbol(uint32_t symbol_type, · line 147

Quoted 10 lines
checkpolicy/module_compiler.c +4 -2
+		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) {

I think you missed one around line 498.

--
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.