From 0ab05634ac37723a4d15f048f543ed32162f9996 Mon Sep 17 00:00:00 2001
From: "ben.franksen" <ben.franksen@online.de>
Date: Wed, 3 Mar 2010 14:40:25 +0000
Subject: [PATCH] removed lots of spurious type cast in compiler

---
 src/snc/gen_ss_code.c | 10 +++++-----
 src/snc/parse.c       | 20 ++++++++++----------
 src/snc/phase2.c      |  2 +-
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/snc/gen_ss_code.c b/src/snc/gen_ss_code.c
index 577de438..dc91f56e 100644
--- a/src/snc/gen_ss_code.c
+++ b/src/snc/gen_ss_code.c
@@ -718,7 +718,7 @@ static void gen_ef_func(
 	if (ep1 != 0 && ep1->type == E_COMMA)
 		ep1 = ep1->left;
 	if ( (ep1 != 0) && (ep1->type == E_VAR) )
-		vp = (Var *)find_var(ep1->value);
+		vp = find_var(ep1->value);
 	else
 		vp = 0;
 		if (vp == 0 || vp->type != V_EVFLAG)
@@ -780,7 +780,7 @@ static void gen_pv_func(
 	id = -1;
 	if (ep1->type == E_VAR)
 	{
-		vp = (Var *)find_var(ep1->value);
+		vp = find_var(ep1->value);
 	}
 	else if (ep1->type == E_SUBSCR)
 	{	/* Form should be: <db variable>[<expression>] */
@@ -788,7 +788,7 @@ static void gen_pv_func(
 		ep3 = ep1->right;	/* subscript */
 		if ( ep2->type == E_VAR )
 		{
-			vp = (Var *)find_var(ep2->value);
+			vp = find_var(ep2->value);
 		}
 	}
 
@@ -891,7 +891,7 @@ static void gen_entry_handler(Expr *expr_list)
 	printf("static void entry_handler(SS_ID ssId, struct UserVar *pVar)\n{\n");
 	for (ep = expr_list; ep != 0; ep = ep->next)
 	{
-		eval_expr(ENTRY_STMT, ep, (Expr *)NULL, 1);
+		eval_expr(ENTRY_STMT, ep, NULL, 1);
 	}
 	printf("}\n\n");
 }
@@ -905,7 +905,7 @@ static void gen_exit_handler(Expr *expr_list)
 	printf("static void exit_handler(SS_ID ssId, struct UserVar *pVar)\n{\n");
 	for (ep = expr_list; ep != 0; ep = ep->next)
 	{
-		eval_expr(EXIT_STMT, ep, (Expr *)NULL, 1);
+		eval_expr(EXIT_STMT, ep, NULL, 1);
 	}
 	printf("}\n\n");
 }
diff --git a/src/snc/parse.c b/src/snc/parse.c
index e7d661e8..fde8c562 100644
--- a/src/snc/parse.c
+++ b/src/snc/parse.c
@@ -112,7 +112,7 @@ void decl_stmt(
 	fprintf(stderr, "length1=%d, length2=%d\n", length1, length2);
 #endif	/*DEBUG*/
 	/* See if variable already declared */
-	vp = (Var *)find_var(name);
+	vp = find_var(name);
 	if (vp != 0)
 	{
 		fprintf(stderr, "variable %s already declared, line %d\n",
@@ -188,7 +188,7 @@ void assign_single(
 	fprintf(stderr, "assign %s to \"%s\";\n", name, db_name);
 #endif	/*DEBUG*/
 	/* Find the variable */
-	vp = (Var *)find_var(name);
+	vp = find_var(name);
 	if (vp == 0)
 	{
 		fprintf(stderr, "assign: variable %s not declared, line %d\n",
@@ -231,7 +231,7 @@ void assign_subscr(
 	fprintf(stderr, "assign %s[%s] to \"%s\";\n", name, subscript, db_name);
 #endif	/*DEBUG*/
 	/* Find the variable */
-	vp = (Var *)find_var(name);
+	vp = find_var(name);
 	if (vp == 0)
 	{
 		fprintf(stderr, "assign: variable %s not declared, line %d\n",
@@ -304,7 +304,7 @@ void assign_list(
 	fprintf(stderr, "assign %s to {", name);
 #endif	/*DEBUG*/
 	/* Find the variable */
-	vp = (Var *)find_var(name);
+	vp = find_var(name);
 	if (vp == 0)
 	{
 		fprintf(stderr, "assign: variable %s not declared, line %d\n",
@@ -419,7 +419,7 @@ void monitor_stmt(
 #endif	/*DEBUG*/
 
 	/* Find the variable */
-	vp = (Var *)find_var(name);
+	vp = find_var(name);
 	if (vp == 0)
 	{
 		fprintf(stderr, "assign: variable %s not declared, line %d\n",
@@ -484,7 +484,7 @@ void sync_stmt(char *name, char *subscript, char *ef_name)
 	 name, subscript?subscript:"(no subscript)", ef_name);
 #endif	/*DEBUG*/
 
-	vp = (Var *)find_var(name);
+	vp = find_var(name);
 	if (vp == 0)
 	{
 		fprintf(stderr, "sync: variable %s not declared, line %d\n",
@@ -501,7 +501,7 @@ void sync_stmt(char *name, char *subscript, char *ef_name)
 	}
 
 	/* Find the event flag varible */
-	vp = (Var *)find_var(ef_name);
+	vp = find_var(ef_name);
 	if (vp == 0 || vp->type != V_EVFLAG)
 	{
 		fprintf(stderr, "sync: e-f variable %s not declared, line %d\n",
@@ -553,7 +553,7 @@ void syncq_stmt(char *name, char *subscript, char *ef_name, char *maxQueueSize)
 #endif	/*DEBUG*/
 
 	/* Find the variable and check it's assigned */
-	vp = (Var *)find_var(name);
+	vp = find_var(name);
 	if (vp == 0)
 	{
 		fprintf(stderr, "syncQ: variable %s not declared, line %d\n",
@@ -578,7 +578,7 @@ void syncq_stmt(char *name, char *subscript, char *ef_name, char *maxQueueSize)
 	}
 
 	/* Find the event flag variable */
-	efp = (Var *)find_var(ef_name);
+	efp = find_var(ef_name);
 	if (efp == 0 || efp->type != V_EVFLAG)
 	{
 		fprintf(stderr, "syncQ: e-f variable %s not declared, "
@@ -705,7 +705,7 @@ Expr *expression(
 		ep, expr_type_names[type], value, left, right);
 #endif	/*DEBUG*/
 	/* Fill in the structure */
-	ep->next = (Expr *)0;
+	ep->next = 0;
 	ep->last = ep;
 	ep->type = type;
 	ep->value = value;
diff --git a/src/snc/phase2.c b/src/snc/phase2.c
index 32167d0a..0c24b2b2 100644
--- a/src/snc/phase2.c
+++ b/src/snc/phase2.c
@@ -227,7 +227,7 @@ static void connect_variable(Expr *ep, void *dummy)
 #ifdef	DEBUG
 	fprintf(stderr, "connect_variable: \"%s\", line %d\n", ep->value, ep->line_num);
 #endif	/*DEBUG*/
-	vp = (Var *)find_var(ep->value);
+	vp = find_var(ep->value);
 #ifdef	DEBUG
 	fprintf(stderr, "\t \"%s\" was %s\n", ep->value, vp ? "found" : "not found" );
 #endif	/*DEBUG*/
-- 
GitLab