All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] Introduce symtab_datum_t
@ 2006-07-31 14:50 Karl MacMillan
  2006-08-01 12:18 ` Joshua Brindle
  0 siblings, 1 reply; 3+ messages in thread
From: Karl MacMillan @ 2006-07-31 14:50 UTC (permalink / raw)
  To: SELinux List

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(-)

diff --git a/checkpolicy/module_compiler.c b/checkpolicy/module_compiler.c
index ec5fc89..3252bb7 100644
--- a/checkpolicy/module_compiler.c
+++ b/checkpolicy/module_compiler.c
@@ -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 majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply related	[flat|nested] 3+ messages in thread
* Ver 2 Introduce symtab_datum_t
@ 2006-08-02 18:03 kmacmillan
  2006-08-02 18:03 ` [PATCH 1/2] " kmacmillan
  0 siblings, 1 reply; 3+ messages in thread
From: kmacmillan @ 2006-08-02 18:03 UTC (permalink / raw)
  To: selinux

This patch set adds a new structure - symtab_datum_t - and converts all
of the datum types to place this struct as their first member. This
unifies the storage of data common to all symtab datums and allows free
casting between specific datum types (e.g., role_datum_t) and
symtab_datum_t. A minor cleanup using this new struct is also included.

A later patch set will build on this to also store scope information in
the symtab_datum_t.

This patch set includes the additional cast pointed out by Josh and has
been rebased to the current head. Again, it conflicts with other patch
sets that are pending - I can rebase this after applying those if needed.

Karl



--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-08-02 18:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-31 14:50 [PATCH 2/2] Introduce symtab_datum_t Karl MacMillan
2006-08-01 12:18 ` Joshua Brindle
  -- strict thread matches above, loose matches on Subject: below --
2006-08-02 18:03 Ver 2 " kmacmillan
2006-08-02 18:03 ` [PATCH 1/2] " kmacmillan
2006-08-02 18:03   ` [PATCH 2/2] " kmacmillan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.