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

* Re: [PATCH 2/2] Introduce symtab_datum_t
  2006-07-31 14:50 [PATCH 2/2] Introduce symtab_datum_t Karl MacMillan
@ 2006-08-01 12:18 ` Joshua Brindle
  0 siblings, 0 replies; 3+ messages in thread
From: Joshua Brindle @ 2006-08-01 12:18 UTC (permalink / raw)
  To: Karl MacMillan; +Cc: SELinux List

Karl MacMillan wrote:
> 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) {
>   
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 majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

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

* [PATCH 2/2] Introduce symtab_datum_t
  2006-08-02 18:03 ` [PATCH 1/2] " kmacmillan
@ 2006-08-02 18:03   ` kmacmillan
  0 siblings, 0 replies; 3+ messages in thread
From: kmacmillan @ 2006-08-02 18:03 UTC (permalink / raw)
  To: selinux; +Cc: Karl MacMillan

From: Karl MacMillan <kmacmill@mentalrootkit.com>

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

diff --git a/checkpolicy/module_compiler.c b/checkpolicy/module_compiler.c
index ec5fc89..977daca 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) {
@@ -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 */
-- 
1.4.1


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

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.