Remove bad casts.

This commit is contained in:
steve 2004-09-10 00:15:45 +00:00
parent a70dd79cd8
commit 98ba641e67
3 changed files with 21 additions and 19 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: cadpli.c,v 1.6 2004/09/05 21:19:51 steve Exp $"
#ident "$Id: cadpli.c,v 1.7 2004/09/10 00:15:45 steve Exp $"
#endif
# include <vpi_user.h>
@ -53,7 +53,7 @@ static void thunker_register(void)
bp = strchr(cp, ':');
assert(bp);
module = (char*)malloc(bp-cp+1);
module = malloc(bp-cp+1);
strncpy(module, cp, bp-cp);
module[bp-cp] = 0;
@ -76,7 +76,7 @@ static void thunker_register(void)
free(module);
assert(boot);
tf = (struct t_tfcell*) (*((funcvp)boot))();
tf = (*((funcvp)boot))();
assert(tf);
veriusertfs_register_table(tf);
@ -91,6 +91,9 @@ void (*vlog_startup_routines[])() = {
/*
* $Log: cadpli.c,v $
* Revision 1.7 2004/09/10 00:15:45 steve
* Remove bad casts.
*
* Revision 1.6 2004/09/05 21:19:51 steve
* Better type safety.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: lexor.lex,v 1.45 2004/09/06 03:01:48 steve Exp $"
#ident "$Id: lexor.lex,v 1.46 2004/09/10 00:15:45 steve Exp $"
#endif
# include "config.h"
@ -416,8 +416,7 @@ static void def_start()
void define_macro(const char*name, const char*value, int keyword)
{
struct define_t*def = (struct define_t*)
malloc(sizeof(struct define_t));
struct define_t*def = malloc(sizeof(struct define_t));
def->name = strdup(name);
def->value = strdup(value);
def->keyword = keyword;
@ -539,7 +538,7 @@ static void do_define()
}
/* Accumulate this text into the define_text string. */
define_text = (char*)realloc(define_text, define_cnt + (cp-yytext) + 1);
define_text = realloc(define_text, define_cnt + (cp-yytext) + 1);
strcpy(define_text+define_cnt, yytext);
define_cnt += cp-yytext;
}
@ -689,8 +688,7 @@ static void include_filename()
fprintf(stderr, "error: malformed `include directive. Extra junk on line?\n");
exit(1);
}
standby = (struct include_stack_t*)
malloc(sizeof(struct include_stack_t));
standby = malloc(sizeof(struct include_stack_t));
standby->path = strdup(yytext+1);
standby->path[strlen(standby->path)-1] = 0;
standby->lineno = 0;
@ -852,8 +850,7 @@ void reset_lexor(FILE*out, char*paths[])
{
unsigned idx;
struct include_stack_t*tail = 0;
struct include_stack_t*isp = (struct include_stack_t*)
malloc(sizeof(struct include_stack_t));
struct include_stack_t*isp = malloc(sizeof(struct include_stack_t));
isp->path = strdup(paths[0]);
isp->file = fopen(paths[0], "r");
isp->str = 0;
@ -877,8 +874,7 @@ void reset_lexor(FILE*out, char*paths[])
that yywrap can pull them when needed. */
file_queue = 0;
for (idx = 1 ; paths[idx] ; idx += 1) {
isp = (struct include_stack_t*)
malloc(sizeof(struct include_stack_t));
isp = malloc(sizeof(struct include_stack_t));
isp->path = strdup(paths[idx]);
isp->str = 0;
isp->next = 0;

View File

@ -17,7 +17,7 @@ const char COPYRIGHT[] =
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: main.c,v 1.19 2004/09/05 21:29:08 steve Exp $"
#ident "$Id: main.c,v 1.20 2004/09/10 00:15:45 steve Exp $"
#endif
# include "config.h"
@ -69,12 +69,12 @@ static unsigned source_cnt = 0;
void add_source_file(const char*name)
{
if (source_list == 0) {
source_list = (char**)calloc(2, sizeof(char*));
source_list = calloc(2, sizeof(char*));
source_list[0] = strdup(name);
source_list[1] = 0;
source_cnt = 1;
} else {
source_list = (char**)realloc(source_list, sizeof(char*) * (source_cnt+2));
source_list = realloc(source_list, sizeof(char*) * (source_cnt+2));
source_list[source_cnt+0] = strdup(name);
source_list[source_cnt+1] = 0;
source_cnt += 1;
@ -149,7 +149,7 @@ int main(int argc, char*argv[])
define_macro("unconnected_drive", "`unconnected_drive", 1);
define_macro("uselib", "`uselib", 1);
include_dir = (char**)malloc(sizeof(char*));
include_dir = malloc(sizeof(char*));
include_dir[0] = strdup(".");
include_cnt = 1;
@ -177,14 +177,14 @@ int main(int argc, char*argv[])
break;
case 'I':
include_dir = (char**)realloc(include_dir,
include_dir = realloc(include_dir,
(include_cnt+1)*sizeof(char*));
include_dir[include_cnt] = strdup(optarg);
include_cnt += 1;
break;
case 'K': {
char*buf = (char*)malloc(strlen(optarg) + 2);
char*buf = malloc(strlen(optarg) + 2);
buf[0] = '`';
strcpy(buf+1, optarg);
define_macro(optarg, buf, 1);
@ -290,6 +290,9 @@ int main(int argc, char*argv[])
/*
* $Log: main.c,v $
* Revision 1.20 2004/09/10 00:15:45 steve
* Remove bad casts.
*
* Revision 1.19 2004/09/05 21:29:08 steve
* Better type safety.
*