From 3369d860b4fd5439b0965dc120bb04de00e15c8f Mon Sep 17 00:00:00 2001 From: rlar Date: Thu, 1 Jul 2010 19:52:23 +0000 Subject: [PATCH] cast the return values of malloc() function calls --- ChangeLog | 58 +++++++++++++++++ src/frontend/com_sysinfo.c | 8 +-- src/frontend/display.c | 2 +- src/frontend/help/readhelp.c | 2 +- src/frontend/help/x11disp.c | 2 +- src/frontend/hpgl.c | 2 +- src/frontend/inpcom.c | 92 +++++++++++++-------------- src/frontend/measure.c | 2 +- src/frontend/numparam/xpressn.c | 10 +-- src/frontend/parser/complete.c | 6 +- src/frontend/plotting/agraf.c | 6 +- src/frontend/plotting/graf.c | 2 +- src/frontend/plotting/x11.c | 2 +- src/frontend/postsc.c | 2 +- src/frontend/quote.c | 2 +- src/frontend/subckt.c | 12 ++-- src/maths/ni/niinteg.c | 4 +- src/maths/ni/niiter.c | 2 +- src/misc/dstring.c | 9 ++- src/misc/string.c | 4 +- src/misc/util.c | 4 +- src/misc/wlist.c | 2 +- src/spicelib/analysis/ckttroub.c | 2 +- src/spicelib/analysis/distoan.c | 2 +- src/spicelib/analysis/noisean.c | 4 +- src/spicelib/devices/bjt/bjtask.c | 6 +- src/spicelib/devices/bjt2/bjt2ask.c | 6 +- src/spicelib/devices/cap/capask.c | 4 +- src/spicelib/devices/cccs/cccsask.c | 4 +- src/spicelib/devices/ccvs/ccvsask.c | 4 +- src/spicelib/devices/cpl/cplsetup.c | 6 +- src/spicelib/devices/csw/cswask.c | 4 +- src/spicelib/devices/dio/dioask.c | 2 +- src/spicelib/devices/dio/diotemp.c | 4 +- src/spicelib/devices/hfet1/hfetask.c | 4 +- src/spicelib/devices/hfet2/hfet2ask.c | 4 +- src/spicelib/devices/ind/indask.c | 4 +- src/spicelib/devices/isrc/isrcask.c | 2 +- src/spicelib/devices/jfet/jfetask.c | 4 +- src/spicelib/devices/jfet2/jfet2ask.c | 4 +- src/spicelib/devices/mes/mesask.c | 4 +- src/spicelib/devices/mesa/mesaask.c | 4 +- src/spicelib/devices/mos1/mos1ask.c | 8 +-- src/spicelib/devices/mos2/mos2ask.c | 8 +-- src/spicelib/devices/mos3/mos3ask.c | 8 +-- src/spicelib/devices/mos6/mos6ask.c | 8 +-- src/spicelib/devices/mos9/mos9ask.c | 8 +-- src/spicelib/devices/res/resask.c | 4 +- src/spicelib/devices/sw/swask.c | 4 +- src/spicelib/devices/vccs/vccsask.c | 4 +- src/spicelib/devices/vcvs/vcvsask.c | 4 +- src/spicelib/devices/vsrc/vsrcask.c | 4 +- src/spicelib/parser/inp2r.c | 2 +- src/spicelib/parser/inpdpar.c | 2 +- src/spicelib/parser/inpmktmp.c | 2 +- src/spicelib/parser/inpptree.c | 8 +-- 56 files changed, 224 insertions(+), 163 deletions(-) diff --git a/ChangeLog b/ChangeLog index 813e9ff50..ac61b5bdb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,61 @@ +2010-07-01 Robert Larice + * src/frontend/com_sysinfo.c , + * src/frontend/display.c , + * src/frontend/help/readhelp.c , + * src/frontend/help/x11disp.c , + * src/frontend/hpgl.c , + * src/frontend/inpcom.c , + * src/frontend/measure.c , + * src/frontend/numparam/xpressn.c , + * src/frontend/parser/complete.c , + * src/frontend/plotting/agraf.c , + * src/frontend/plotting/graf.c , + * src/frontend/plotting/x11.c , + * src/frontend/postsc.c , + * src/frontend/quote.c , + * src/frontend/subckt.c , + * src/maths/ni/niinteg.c , + * src/maths/ni/niiter.c , + * src/misc/dstring.c , + * src/misc/string.c , + * src/misc/util.c , + * src/misc/wlist.c , + * src/spicelib/analysis/ckttroub.c , + * src/spicelib/analysis/distoan.c , + * src/spicelib/analysis/noisean.c , + * src/spicelib/devices/bjt/bjtask.c , + * src/spicelib/devices/bjt2/bjt2ask.c , + * src/spicelib/devices/cap/capask.c , + * src/spicelib/devices/cccs/cccsask.c , + * src/spicelib/devices/ccvs/ccvsask.c , + * src/spicelib/devices/cpl/cplsetup.c , + * src/spicelib/devices/csw/cswask.c , + * src/spicelib/devices/dio/dioask.c , + * src/spicelib/devices/dio/diotemp.c , + * src/spicelib/devices/hfet1/hfetask.c , + * src/spicelib/devices/hfet2/hfet2ask.c , + * src/spicelib/devices/ind/indask.c , + * src/spicelib/devices/isrc/isrcask.c , + * src/spicelib/devices/jfet/jfetask.c , + * src/spicelib/devices/jfet2/jfet2ask.c , + * src/spicelib/devices/mes/mesask.c , + * src/spicelib/devices/mesa/mesaask.c , + * src/spicelib/devices/mos1/mos1ask.c , + * src/spicelib/devices/mos2/mos2ask.c , + * src/spicelib/devices/mos3/mos3ask.c , + * src/spicelib/devices/mos6/mos6ask.c , + * src/spicelib/devices/mos9/mos9ask.c , + * src/spicelib/devices/res/resask.c , + * src/spicelib/devices/sw/swask.c , + * src/spicelib/devices/vccs/vccsask.c , + * src/spicelib/devices/vcvs/vcvsask.c , + * src/spicelib/devices/vsrc/vsrcask.c , + * src/spicelib/parser/inp2r.c , + * src/spicelib/parser/inpdpar.c , + * src/spicelib/parser/inpmktmp.c , + * src/spicelib/parser/inpptree.c : + cast the return values of malloc() function calls + 2010-07-01 Robert Larice * src/frontend/inpcom.c, * src/spicelib/devices/cktinit.c : diff --git a/src/frontend/com_sysinfo.c b/src/frontend/com_sysinfo.c index 29d200454..19b4b0a91 100644 --- a/src/frontend/com_sysinfo.c +++ b/src/frontend/com_sysinfo.c @@ -220,7 +220,7 @@ TesError tesCreateSystemInfo(TesSystemInfo *info) { buf = fgetc(file); } - info->osName = malloc((size) * sizeof(char)); + info->osName = (char*) malloc((size) * sizeof(char)); rewind(file); fread(info->osName, sizeof(char), size, file); fclose(file); @@ -244,7 +244,7 @@ TesError tesCreateSystemInfo(TesSystemInfo *info) { buf = fgetc(file); } /* get complete string */ - inStr = malloc((size+1) * sizeof(char)); + inStr = (char*) malloc((size+1) * sizeof(char)); rewind(file); fread(inStr, sizeof(char), size, file); inStr[size] = '\0'; @@ -262,7 +262,7 @@ TesError tesCreateSystemInfo(TesSystemInfo *info) { if(numToEOL > 2) { /* skip ": "*/ numToEOL-=2; - info->cpuModelName = malloc(numToEOL+1); + info->cpuModelName = (char*) malloc(numToEOL+1); memcpy(info->cpuModelName, modelPtr+2, numToEOL); info->cpuModelName[numToEOL] = '\0'; } @@ -289,7 +289,7 @@ TesError tesCreateSystemInfo(TesSystemInfo *info) { if (isblank(*strPtr)) numProcs++; } info->numLogicalProcessors = numProcs; - physIDs = malloc(numProcs * sizeof(tInt)); + physIDs = (tInt*) malloc(numProcs * sizeof(tInt)); /* get number of physical CPUs */ numProcs = 0; diff --git a/src/frontend/display.c b/src/frontend/display.c index bd5974f1b..689620053 100644 --- a/src/frontend/display.c +++ b/src/frontend/display.c @@ -363,7 +363,7 @@ void SaveText(GRAPH *graph, char *text, int x, int y) graph->keyed = keyed; } - keyed->text = tmalloc(strlen(text) + 1); + keyed->text = (char*) tmalloc(strlen(text) + 1); strcpy(keyed->text, text); keyed->x = x; diff --git a/src/frontend/help/readhelp.c b/src/frontend/help/readhelp.c index 38af93a49..3d8ec89ac 100644 --- a/src/frontend/help/readhelp.c +++ b/src/frontend/help/readhelp.c @@ -188,7 +188,7 @@ static toplink *getsubtoplink(char **ss) if ((tmp =strchr(s, ':'))) { tl->place = alloc(fplace); tl->place->filename = strncpy( - tmalloc((unsigned) (sizeof (char) * (tmp - s + 1))), + (char*) tmalloc((unsigned) (sizeof (char) * (tmp - s + 1))), s, (tmp - s)); tl->place->filename[tmp - s] = '\0'; strtolower(tl->place->filename); diff --git a/src/frontend/help/x11disp.c b/src/frontend/help/x11disp.c index 10199802c..06775ac04 100644 --- a/src/frontend/help/x11disp.c +++ b/src/frontend/help/x11disp.c @@ -123,7 +123,7 @@ hlp_xdisplay(topic *top) top->titlewidget, buttonargs, XtNumber(buttonargs)); XtAddCallback(buttonwidget, XtNcallback, (XtCallbackProc) delete, top); - buf = tmalloc(80 * top->numlines + 100); + buf = (char*) tmalloc(80 * top->numlines + 100); buf[0] = '\0'; for (wl = top->text; wl; wl = wl->wl_next) { sputline(buf, wl->wl_word); diff --git a/src/frontend/hpgl.c b/src/frontend/hpgl.c index 80bd6ea02..16f0026ca 100644 --- a/src/frontend/hpgl.c +++ b/src/frontend/hpgl.c @@ -153,7 +153,7 @@ GRAPH *graph) if (!screenflag) #endif - graph->devdep = tmalloc(sizeof(GLdevdep)); + graph->devdep = (char*) tmalloc(sizeof(GLdevdep)); DEVDEP(graph).lastlinestyle = -1; DEVDEP(graph).lastx = -1; DEVDEP(graph).lasty = -1; diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 6f1fd469c..33afeaec5 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -137,7 +137,7 @@ readline(FILE *fd) strptr = NULL; strlen = 0; memlen = STRGROW; - strptr = tmalloc(memlen); + strptr = (char*) tmalloc(memlen); memlen -= 1; /* Save constant -1's in while loop */ while((c = getc(fd)) != EOF) { if (strlen == 0 && (c == '\t' || c == ' ')) /* Leading spaces away */ @@ -146,7 +146,7 @@ readline(FILE *fd) strlen++; if( strlen >= memlen ) { memlen += STRGROW; - if( !(strptr = trealloc(strptr, memlen + 1))) { + if( !(strptr = (char*) trealloc(strptr, memlen + 1))) { return (NULL); } } @@ -160,7 +160,7 @@ readline(FILE *fd) } // strptr[strlen] = '\0'; /* Trim the string */ - strptr = trealloc(strptr, strlen + 1); + strptr = (char*) trealloc(strptr, strlen + 1); strptr[strlen] = '\0'; return (strptr); } @@ -389,7 +389,7 @@ inp_add_control_section( struct line *deck, int *line_number ) { found_run = TRUE; } if ( cp_getvar( "rawfile", VT_STRING, rawfile ) ) { - line = tmalloc( strlen("write") + strlen(rawfile) + 2 ); + line = (char*) tmalloc( strlen("write") + strlen(rawfile) + 2 ); sprintf(line, "write %s", rawfile); newcard = create_new_card( line, line_number ); prev_card->li_next = newcard; @@ -408,7 +408,7 @@ inp_add_control_section( struct line *deck, int *line_number ) { newcard->li_next = prev_card; if ( cp_getvar( "rawfile", VT_STRING, rawfile ) ) { - line = tmalloc( strlen("write") + strlen(rawfile) + 2 ); + line = (char*) tmalloc( strlen("write") + strlen(rawfile) + 2 ); sprintf(line, "write %s", rawfile); prev_card = deck->li_next; newcard = create_new_card( line, line_number ); @@ -475,10 +475,10 @@ inp_fix_macro_param_func_paren_io( struct line *begin_card ) { while( !isspace(*str_ptr) ) str_ptr++; if ( ciprefix( ".macro", card->li_line ) ) { - new_str = tmalloc( strlen(".subckt") + strlen(str_ptr) + 1 ); + new_str = (char*) tmalloc( strlen(".subckt") + strlen(str_ptr) + 1 ); sprintf( new_str, ".subckt%s", str_ptr ); } else { - new_str = tmalloc( strlen(".ends") + strlen(str_ptr) + 1 ); + new_str = (char*) tmalloc( strlen(".ends") + strlen(str_ptr) + 1 ); sprintf( new_str, ".ends%s", str_ptr ); } @@ -990,19 +990,19 @@ inp_fix_ternary_operator_str( char *line ) if ( end_str != NULL ) { if ( beg_str != NULL ) { - new_str = tmalloc( strlen(beg_str) + strlen("ternary_fcn") + strlen(conditional) + strlen(if_str) + strlen(else_str) + strlen(end_str) + 5 ); + new_str = (char*) tmalloc( strlen(beg_str) + strlen("ternary_fcn") + strlen(conditional) + strlen(if_str) + strlen(else_str) + strlen(end_str) + 5 ); sprintf( new_str, "%sternary_fcn(%s,%s,%s)%s", beg_str, conditional, if_str, else_str, end_str ); } else { - new_str = tmalloc( strlen("ternary_fcn") + strlen(conditional) + strlen(if_str) + strlen(else_str) + strlen(end_str) + 5 ); + new_str = (char*) tmalloc( strlen("ternary_fcn") + strlen(conditional) + strlen(if_str) + strlen(else_str) + strlen(end_str) + 5 ); sprintf( new_str, "ternary_fcn(%s,%s,%s)%s", conditional, if_str, else_str, end_str ); } } else { if ( beg_str != NULL ) { - new_str = tmalloc( strlen(beg_str) + strlen("ternary_fcn") + strlen(conditional) + strlen(if_str) + strlen(else_str) + 5 ); + new_str = (char*) tmalloc( strlen(beg_str) + strlen("ternary_fcn") + strlen(conditional) + strlen(if_str) + strlen(else_str) + 5 ); sprintf( new_str, "%sternary_fcn(%s,%s,%s)", beg_str, conditional, if_str, else_str ); } else { - new_str = tmalloc( strlen("ternary_fcn") + strlen(conditional) + strlen(if_str) + strlen(else_str) + 5 ); + new_str = (char*) tmalloc( strlen("ternary_fcn") + strlen(conditional) + strlen(if_str) + strlen(else_str) + 5 ); sprintf( new_str, "ternary_fcn(%s,%s,%s)", conditional, if_str, else_str ); } } @@ -1101,7 +1101,7 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c if ( call_depth == 0 && line_count == 0 ) { line_count++; if ( fgets( big_buff, 5000, fp ) ) { -/* buffer = tmalloc( strlen(big_buff) + 1 ); +/* buffer = (char*) tmalloc( strlen(big_buff) + 1 ); strcpy(buffer, big_buff); */ buffer = copy(big_buff); } @@ -1346,7 +1346,7 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c } if ( shell_eol_continuation ) { - char *new_buffer = tmalloc( strlen(buffer) + 2); + char *new_buffer = (char*) tmalloc( strlen(buffer) + 2); sprintf( new_buffer, "+%s", buffer ); tfree(buffer); @@ -1381,7 +1381,7 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c if ( call_depth == 0 && found_end == TRUE) { if ( global == NULL ) { - global = tmalloc( strlen(".global gnd") + 1 ); + global = (char*) tmalloc( strlen(".global gnd") + 1 ); sprintf( global, ".global gnd" ); } global_card = alloc(struct line); @@ -1476,7 +1476,7 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c end->li_next = alloc(struct line); /* create next card */ end = end->li_next; /* point to next card */ - buffer = tmalloc( strlen( ".end" ) + 1 ); + buffer = (char*) tmalloc( strlen( ".end" ) + 1 ); sprintf( buffer, ".end" ); /* now put buffer into li */ @@ -1528,7 +1528,7 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c } /* create buffer and write last and current line into it. */ - buffer = tmalloc(strlen(prev->li_line) + strlen(s) + 2); + buffer = (char*) tmalloc(strlen(prev->li_line) + strlen(s) + 2); (void) sprintf(buffer, "%s %s", prev->li_line, s + 1); s = prev->li_line; @@ -1852,7 +1852,7 @@ inp_fix_subckt( char *s ) if ( new_str == NULL ) new_str = strdup(c->li_line); else { str = new_str; - new_str = tmalloc( strlen(str) + strlen(c->li_line) + 2 ); + new_str = (char*) tmalloc( strlen(str) + strlen(c->li_line) + 2 ); sprintf( new_str, "%s %s", str, c->li_line ); tfree(str); } @@ -1863,7 +1863,7 @@ inp_fix_subckt( char *s ) } /* create buffer and insert params: */ - buffer = tmalloc( strlen(s) + 9 + strlen(new_str) + 1 ); + buffer = (char*) tmalloc( strlen(s) + 9 + strlen(new_str) + 1 ); sprintf( buffer, "%s params: %s", s, new_str ); tfree(s); tfree(new_str); @@ -1881,7 +1881,7 @@ inp_remove_ws( char *s ) char *buffer, *curr; bool is_expression = FALSE; - big_buff = tmalloc( strlen(s) + 1 ); + big_buff = (char*) tmalloc( strlen(s) + 1 ); curr = s; while ( *curr != '\0' ) { @@ -2158,7 +2158,7 @@ inp_fix_inst_line( char *inst_line, } for ( i = 0; i < num_subckt_params; i++ ) { - new_line = tmalloc( strlen( curr_line ) + strlen( subckt_param_values[i] ) + 2 ); + new_line = (char*) tmalloc( strlen( curr_line ) + strlen( subckt_param_values[i] ) + 2 ); sprintf( new_line, "%s %s", curr_line, subckt_param_values[i] ); tfree( curr_line ); @@ -2204,11 +2204,11 @@ inp_fix_subckt_multiplier( struct line *subckt_card, num_subckt_params = num_subckt_params + 1; if ( !strstr( subckt_card->li_line, "params:" ) ) { - new_str = tmalloc( strlen( subckt_card->li_line ) + 13 ); + new_str = (char*) tmalloc( strlen( subckt_card->li_line ) + 13 ); sprintf( new_str, "%s params: m=1", subckt_card->li_line ); subckt_w_params[num_subckt_w_params++] = get_subckt_model_name( subckt_card->li_line ); } else { - new_str = tmalloc( strlen( subckt_card->li_line ) + 5 ); + new_str = (char*) tmalloc( strlen( subckt_card->li_line ) + 5 ); sprintf( new_str, "%s m=1", subckt_card->li_line ); } @@ -2221,7 +2221,7 @@ inp_fix_subckt_multiplier( struct line *subckt_card, /* no 'm' for B line or comment line */ if ((*(card->li_line) == '*') || (*(card->li_line) == 'b')) continue; - new_str = tmalloc( strlen( card->li_line ) + 7 ); + new_str = (char*) tmalloc( strlen( card->li_line ) + 7 ); sprintf( new_str, "%s m={m}", card->li_line ); tfree( card->li_line ); @@ -2495,20 +2495,20 @@ inp_do_macro_param_replace( int fcn_number, char *params[] ) if ( curr_str != NULL ) { if ( str_has_arith_char( params[i] ) ) { - new_str = tmalloc( strlen(curr_str) + strlen(curr_ptr) + strlen(params[i]) + 3 ); + new_str = (char*) tmalloc( strlen(curr_str) + strlen(curr_ptr) + strlen(params[i]) + 3 ); sprintf( new_str, "%s%s(%s)", curr_str, curr_ptr, params[i] ); } else { - new_str = tmalloc( strlen(curr_str) + strlen(curr_ptr) + strlen(params[i]) + 1 ); + new_str = (char*) tmalloc( strlen(curr_str) + strlen(curr_ptr) + strlen(params[i]) + 1 ); sprintf( new_str, "%s%s%s", curr_str, curr_ptr, params[i] ); } tfree( curr_str ); } else { if ( str_has_arith_char( params[i] ) ) { - new_str = tmalloc( strlen(curr_ptr) + strlen(params[i]) + 3 ); + new_str = (char*) tmalloc( strlen(curr_ptr) + strlen(params[i]) + 3 ); sprintf( new_str, "%s(%s)", curr_ptr, params[i] ); } else { - new_str = tmalloc( strlen(curr_ptr) + strlen(params[i]) + 1 ); + new_str = (char*) tmalloc( strlen(curr_ptr) + strlen(params[i]) + 1 ); sprintf( new_str, "%s%s", curr_ptr, params[i] ); } } @@ -2521,7 +2521,7 @@ inp_do_macro_param_replace( int fcn_number, char *params[] ) if ( curr_str == NULL ) { curr_str = curr_ptr; } else { - new_str = tmalloc( strlen(curr_str) + strlen(curr_ptr) + 1 ); + new_str = (char*) tmalloc( strlen(curr_str) + strlen(curr_ptr) + 1 ); sprintf( new_str, "%s%s", curr_str, curr_ptr ); tfree(curr_str); curr_str = new_str; @@ -2611,11 +2611,11 @@ inp_expand_macro_in_str( char *str ) keep = *fcn_name; *fcn_name = '\0'; if ( curr_str == NULL ) { - new_str = tmalloc( strlen(str) + strlen(macro_str) + strlen(close_paren_ptr+1) + 3 ); + new_str = (char*) tmalloc( strlen(str) + strlen(macro_str) + strlen(close_paren_ptr+1) + 3 ); sprintf( new_str, "%s(%s)", str, macro_str ); curr_str = new_str; } else { - new_str = tmalloc( strlen(curr_str) + strlen(str) + strlen(macro_str) + strlen(close_paren_ptr+1) + 3 ); + new_str = (char*) tmalloc( strlen(curr_str) + strlen(str) + strlen(macro_str) + strlen(close_paren_ptr+1) + 3 ); sprintf( new_str, "%s%s(%s)", curr_str, str, macro_str ); tfree(curr_str); curr_str = new_str; @@ -2638,7 +2638,7 @@ inp_expand_macro_in_str( char *str ) } else { if ( str != NULL ) { - new_str = tmalloc( strlen(curr_str) + strlen(str) + 1 ); + new_str = (char*) tmalloc( strlen(curr_str) + strlen(str) + 1 ); sprintf( new_str, "%s%s", curr_str, str ); tfree(curr_str); curr_str = new_str; @@ -2768,7 +2768,7 @@ inp_fix_param_values( struct line *deck ) end_of_str++; n++; } - vec_str = tmalloc(n); /* string xx yyy from vector [xx yyy] */ + vec_str = (char*) tmalloc(n); /* string xx yyy from vector [xx yyy] */ *vec_str = '\0'; strncat(vec_str, beg_of_str + 1, n - 1); @@ -2779,7 +2779,7 @@ inp_fix_param_values( struct line *deck ) if (!natok) break; wl = alloc(struct wordlist); - buffer = tmalloc(strlen(natok) + 4); + buffer = (char*) tmalloc(strlen(natok) + 4); if ( isdigit(*natok) || *natok == '{' || *natok == '.' || *natok == '"' || ( *natok == '-' && isdigit(*(natok+1)) ) || ciprefix("true", natok) || ciprefix("false", natok) || @@ -2823,7 +2823,7 @@ inp_fix_param_values( struct line *deck ) wl_free(nwl); /* insert new vector into actual line */ *equal_ptr = '\0'; - new_str = tmalloc( strlen(c->li_line) + strlen(newvec) + strlen(end_of_str+1) + 5 ); + new_str = (char*) tmalloc( strlen(c->li_line) + strlen(newvec) + strlen(end_of_str+1) + 5 ); sprintf( new_str, "%s=[%s] %s", c->li_line, newvec, end_of_str+1 ); tfree(newvec); @@ -2840,7 +2840,7 @@ inp_fix_param_values( struct line *deck ) end_of_str++; n++; } - vec_str = tmalloc(n); /* string xx yyy from vector [xx yyy] */ + vec_str = (char*) tmalloc(n); /* string xx yyy from vector [xx yyy] */ *vec_str = '\0'; strncat(vec_str, beg_of_str + 1, n - 1); @@ -2851,7 +2851,7 @@ inp_fix_param_values( struct line *deck ) if (!natok) break; wl = alloc(struct wordlist); - buffer = tmalloc(strlen(natok) + 4); + buffer = (char*) tmalloc(strlen(natok) + 4); if ( isdigit(*natok) || *natok == '{' || *natok == '.' || *natok == '"' || ( *natok == '-' && isdigit(*(natok+1)) ) || ciprefix("true", natok) || ciprefix("false", natok)) { @@ -2873,7 +2873,7 @@ inp_fix_param_values( struct line *deck ) wl_free(nwl); /* insert new complex value into actual line */ *equal_ptr = '\0'; - new_str = tmalloc( strlen(c->li_line) + strlen(newvec) + strlen(end_of_str+1) + 5 ); + new_str = (char*) tmalloc( strlen(c->li_line) + strlen(newvec) + strlen(end_of_str+1) + 5 ); sprintf( new_str, "%s=<%s> %s", c->li_line, newvec, end_of_str+1 ); tfree(newvec); @@ -2893,13 +2893,13 @@ inp_fix_param_values( struct line *deck ) *equal_ptr = '\0'; if ( *end_of_str == '\0' ) { - new_str = tmalloc( strlen(c->li_line) + strlen(beg_of_str) + 4 ); + new_str = (char*) tmalloc( strlen(c->li_line) + strlen(beg_of_str) + 4 ); sprintf( new_str, "%s={%s}", c->li_line, beg_of_str ); } else { *end_of_str = '\0'; - new_str = tmalloc( strlen(c->li_line) + strlen(beg_of_str) + strlen(end_of_str+1) + 5 ); + new_str = (char*) tmalloc( strlen(c->li_line) + strlen(beg_of_str) + strlen(end_of_str+1) + 5 ); sprintf( new_str, "%s={%s} %s", c->li_line, beg_of_str, end_of_str+1 ); } old_str = c->li_line; @@ -3235,12 +3235,12 @@ inp_sort_params( struct line *start_card, struct line *end_card, struct line *ca *str_ptr = '\0'; if ( *end != '\0' ) { - new_str = tmalloc( strlen(curr_line) + strlen(param_names[i]) + strlen(end) + 3 ); + new_str = (char*) tmalloc( strlen(curr_line) + strlen(param_names[i]) + strlen(end) + 3 ); sprintf( new_str, "%s{%s}%s", curr_line, param_names[i], end ); } else { - new_str = tmalloc( strlen(curr_line) + strlen(param_names[i]) + 3 ); + new_str = (char*) tmalloc( strlen(curr_line) + strlen(param_names[i]) + 3 ); sprintf( new_str, "%s{%s}", curr_line, param_names[i] ); } str_ptr = new_str + strlen(curr_line) + strlen(param_names[i]); @@ -3314,7 +3314,7 @@ inp_add_params_to_subckt( struct line *subckt_card ) while ( isspace(*param_ptr) ) param_ptr++; if ( !strstr( subckt_line, "params:" ) ) { - new_line = tmalloc( strlen(subckt_line) + strlen("params: ") + strlen(param_ptr) + 2 ); + new_line = (char*) tmalloc( strlen(subckt_line) + strlen("params: ") + strlen(param_ptr) + 2 ); sprintf( new_line, "%s params: %s", subckt_line, param_ptr ); subckt_name = subckt_card->li_line; @@ -3327,7 +3327,7 @@ inp_add_params_to_subckt( struct line *subckt_card ) subckt_w_params[num_subckt_w_params++] = strdup(subckt_name); *end_ptr = keep; } else { - new_line = tmalloc( strlen(subckt_line) + strlen(param_ptr) + 2 ); + new_line = (char*) tmalloc( strlen(subckt_line) + strlen(param_ptr) + 2 ); sprintf( new_line, "%s %s", subckt_line, param_ptr ); } @@ -3452,7 +3452,7 @@ inp_split_multi_param_lines( struct line *deck, int line_num ) beg_param++; keep = *end_param; *end_param = '\0'; - new_line = tmalloc( strlen(".param ") + strlen(beg_param) + 1 ); + new_line = (char*) tmalloc( strlen(".param ") + strlen(beg_param) + 1 ); sprintf( new_line, ".param %s", beg_param ); array[counter++] = new_line; *end_param = keep; @@ -4091,7 +4091,7 @@ static void inp_bsource_compat(struct line *deck) /* {} around all other tokens */ else { xlen = strlen(buf); - tmp_char = tmalloc(xlen + 3); + tmp_char = (char*) tmalloc(xlen + 3); sprintf(tmp_char, "{%s}", buf); cwl->wl_word = tmp_char; } @@ -4133,7 +4133,7 @@ static void inp_bsource_compat(struct line *deck) /* cut the tmp_char after the equal sign */ *(equal_ptr + 1) = '\0'; xlen = strlen(tmp_char) + strlen(new_str) + 2; - final_str = tmalloc(xlen); + final_str = (char*) tmalloc(xlen); sprintf(final_str, "%s %s", tmp_char, new_str); new_line = alloc(struct line); diff --git a/src/frontend/measure.c b/src/frontend/measure.c index 34a2d9f90..e33a77f30 100644 --- a/src/frontend/measure.c +++ b/src/frontend/measure.c @@ -418,7 +418,7 @@ static wordlist *measure_parse_line( char *line ) break ; } len += strlen( extra_item ) + 2 ; - long_str = MALLOC(len) ; + long_str = (char*) MALLOC(len) ; sprintf( long_str, "%s%s", item, extra_item ) ; txfree( item ) ; txfree( extra_item ) ; diff --git a/src/frontend/numparam/xpressn.c b/src/frontend/numparam/xpressn.c index 3f558af34..e203678e2 100644 --- a/src/frontend/numparam/xpressn.c +++ b/src/frontend/numparam/xpressn.c @@ -193,8 +193,8 @@ initdico (tdico * dico) dico->stack_depth = 0 ; /* top of the stack */ asize = dico->symbol_stack_alloc = 10 ;/* expected stack depth - no longer limited */ asize++ ; /* account for zero */ - dico->local_symbols = tmalloc( asize * sizeof(NGHASHPTR) ) ; - dico->inst_name = tmalloc( asize * sizeof(char *) ) ; + dico->local_symbols = (NGHASHPTR*) tmalloc( asize * sizeof(NGHASHPTR) ) ; + dico->inst_name = (char**) tmalloc( asize * sizeof(char *) ) ; dico->inst_symbols = NULL ; /* instance qualified are lazily allocated */ initkeys (); @@ -244,8 +244,8 @@ dicostack (tdico * dico, char op) /* Just double the stack alloc */ dico->symbol_stack_alloc *= 2 ; asize = dico->symbol_stack_alloc + 1 ; /* account for zero */ - dico->local_symbols = trealloc( dico->local_symbols, asize * sizeof(NGHASHPTR) ) ; - dico->inst_name = trealloc( dico->inst_name, asize * sizeof(char *) ) ; + dico->local_symbols = (NGHASHPTR*) trealloc( dico->local_symbols, asize * sizeof(NGHASHPTR) ) ; + dico->inst_name = (char**) trealloc( dico->inst_name, asize * sizeof(char *) ) ; } /* lazy allocation - don't allocate space if we can help it */ dico->local_symbols[dico->stack_depth] = NULL ; @@ -399,7 +399,7 @@ attrib (tdico *dico_p, NGHASHPTR htable_p, char *t, char op) if (!(entry_p)) { - entry_p = tmalloc( sizeof(entry) ) ; + entry_p = (entry*) tmalloc( sizeof(entry) ) ; entry_p->symbol = strdup( t ) ; entry_p->tp = '?'; /* signal Unknown */ entry_p->level = dico_p->stack_depth ; diff --git a/src/frontend/parser/complete.c b/src/frontend/parser/complete.c index 912bec75f..3674c7a82 100644 --- a/src/frontend/parser/complete.c +++ b/src/frontend/parser/complete.c @@ -627,7 +627,7 @@ clookup(register char *word, struct ccom **dd, bool pref, bool create) place->cc_sibling->cc_ysibling = place; place->cc_sibling->cc_parent = place->cc_parent; place = place->cc_sibling; - place->cc_name = tmalloc(ind + 2); + place->cc_name = (char*) tmalloc(ind + 2); for (i = 0; i < ind + 1; i++) place->cc_name[i] = word[i]; place->cc_name[ind + 1] = '\0'; @@ -651,7 +651,7 @@ clookup(register char *word, struct ccom **dd, bool pref, bool create) tmpc->cc_parent->cc_child = tmpc; else *dd = place; - place->cc_name = tmalloc(ind + 2); + place->cc_name = (char*) tmalloc(ind + 2); for (i = 0; i < ind + 1; i++) place->cc_name[i] = word[i]; place->cc_name[ind + 1] = '\0'; @@ -673,7 +673,7 @@ clookup(register char *word, struct ccom **dd, bool pref, bool create) tmpc->cc_parent = place; place->cc_child = tmpc; place = tmpc; - place->cc_name = tmalloc(ind + 3); + place->cc_name = (char*) tmalloc(ind + 3); for (i = 0; i < ind + 2; i++) place->cc_name[i] = word[i]; place->cc_name[ind + 2] = '\0'; diff --git a/src/frontend/plotting/agraf.c b/src/frontend/plotting/agraf.c index f0059054b..a3bd22668 100644 --- a/src/frontend/plotting/agraf.c +++ b/src/frontend/plotting/agraf.c @@ -95,9 +95,9 @@ ft_agraf(double *xlims, double *ylims, struct dvec *xscale, struct plot *plot, s v->v_linestyle = (PCHARS[i] ? PCHARS[i++] : '#'); } /* Now allocate the field and stuff. */ - field = tmalloc((maxy + 1) * (maxx + 1)); - line1 = tmalloc(maxy + margin + FUDGE + 1); - line2 = tmalloc(maxy + margin + FUDGE + 1); + field = (char*) tmalloc((maxy + 1) * (maxx + 1)); + line1 = (char*) tmalloc(maxy + margin + FUDGE + 1); + line2 = (char*) tmalloc(maxy + margin + FUDGE + 1); if (!novalue) values = (double *) tmalloc(maxx * sizeof (double)); diff --git a/src/frontend/plotting/graf.c b/src/frontend/plotting/graf.c index 914dfa773..fc8daa3a0 100644 --- a/src/frontend/plotting/graf.c +++ b/src/frontend/plotting/graf.c @@ -194,7 +194,7 @@ gr_init(double *xlims, double *ylims, /* The size of the screen. */ pname = "(unknown)"; if (!plotname) plotname = "(unknown)"; - comb_title = tmalloc(strlen(plotname) + strlen(pname) + 3); + comb_title = (char*) tmalloc(strlen(plotname) + strlen(pname) + 3); sprintf(comb_title, "%s: %s", pname, plotname); graph->plotname = comb_title; #endif diff --git a/src/frontend/plotting/x11.c b/src/frontend/plotting/x11.c index 904e1ac30..b8731daea 100644 --- a/src/frontend/plotting/x11.c +++ b/src/frontend/plotting/x11.c @@ -365,7 +365,7 @@ X11_NewViewport(GRAPH *graph) }; int trys; - graph->devdep = tmalloc(sizeof(X11devdep)); + graph->devdep = (char*) tmalloc(sizeof(X11devdep)); /* set up new shell */ DEVDEP(graph).shell = XtCreateApplicationShell("shell", diff --git a/src/frontend/postsc.c b/src/frontend/postsc.c index bec2596f5..4f7ecb5eb 100644 --- a/src/frontend/postsc.c +++ b/src/frontend/postsc.c @@ -217,7 +217,7 @@ PS_NewViewport(GRAPH *graph) fprintf(plotfile, "/%s findfont %d scalefont setfont\n\n", psfont, (int) (fontsize * scale)); - graph->devdep = tmalloc(sizeof(PSdevdep)); + graph->devdep = (char*) tmalloc(sizeof(PSdevdep)); DEVDEP(graph).lastlinestyle = -1; DEVDEP(graph).lastcolor = -1; DEVDEP(graph).lastx = -1; diff --git a/src/frontend/quote.c b/src/frontend/quote.c index 60810a497..3747b28e4 100644 --- a/src/frontend/quote.c +++ b/src/frontend/quote.c @@ -79,7 +79,7 @@ cp_unquote(char *string) int l; if (string) { l = strlen(string); - s = MALLOC(l+1); + s = (char*) MALLOC(l+1); if (*string == '"' && string[l-1] == '"') { strncpy(s,string+1,l-2); diff --git a/src/frontend/subckt.c b/src/frontend/subckt.c index 1163afba6..a31afa9ff 100644 --- a/src/frontend/subckt.c +++ b/src/frontend/subckt.c @@ -758,7 +758,7 @@ bxx_init(struct bxx_buffer *t) { /* assert(0 == (bxx_chunksize & (bxx_chunksize - 1))); */ - t->buffer = tmalloc(bxx_chunksize); + t->buffer = (char*) tmalloc(bxx_chunksize); t->dst = t->buffer; t->limit = t->buffer + bxx_chunksize; @@ -786,7 +786,7 @@ bxx_extend(struct bxx_buffer *t, int howmuch) howmuch += (bxx_chunksize - 1); howmuch &= ~(bxx_chunksize - 1); - t->buffer = trealloc(t->buffer, len += howmuch); + t->buffer = (char*) trealloc(t->buffer, len += howmuch); t->dst = t->buffer + pos; t->limit = t->buffer + len; @@ -912,10 +912,10 @@ translate(struct line *deck, char *formal, char *actual, char *scname, char *sub t = gettrans(name, NULL); if (t) { - new_str = tmalloc( strlen(s) + strlen(t) + strlen(paren_ptr+1) + 3 ); + new_str = (char*) tmalloc( strlen(s) + strlen(t) + strlen(paren_ptr+1) + 3 ); sprintf( new_str, "%s(%s)%s", s, t, paren_ptr+1 ); } else { - new_str = tmalloc( strlen(s) + strlen(scname) + strlen(name) + strlen(paren_ptr+1) + 4 ); + new_str = (char*) tmalloc( strlen(s) + strlen(scname) + strlen(name) + strlen(paren_ptr+1) + 4 ); sprintf( new_str, "%s(%s.%s)%s", s, scname, name, paren_ptr+1 ); } @@ -1674,7 +1674,7 @@ modtranslate(struct line *deck, char *subname) #endif name = gettok(&t); /* at this point, name = .model */ - buffer = tmalloc(strlen(name) + strlen(t) + + buffer = (char*) tmalloc(strlen(name) + strlen(t) + strlen(subname) + 4); (void) sprintf(buffer, "%s ",name); /* at this point, buffer = ".model " */ tfree(name); @@ -1754,7 +1754,7 @@ devmodtranslate(struct line *deck, char *subname) t++; c = isupper(*t) ? tolower(*t) : *t; /* set c to first char in line. . . . */ found = FALSE; - buffer = tmalloc(strlen(t) + strlen(subname) + 4); + buffer = (char*) tmalloc(strlen(t) + strlen(subname) + 4); switch (c) { diff --git a/src/maths/ni/niinteg.c b/src/maths/ni/niinteg.c index d25e3b048..9e878133f 100644 --- a/src/maths/ni/niinteg.c +++ b/src/maths/ni/niinteg.c @@ -35,7 +35,7 @@ NIintegrate(CKTcircuit *ckt, double *geq, double *ceq, double cap, int qcap) ( *(ckt->CKTstate0+qcap) - *(ckt->CKTstate1+qcap) ); break; default: - errMsg = MALLOC(strlen(ordmsg)+1); + errMsg = (char*) MALLOC(strlen(ordmsg)+1); strcpy(errMsg,ordmsg); return(E_ORDER); } @@ -71,7 +71,7 @@ NIintegrate(CKTcircuit *ckt, double *geq, double *ceq, double cap, int qcap) break; default: - errMsg = MALLOC(strlen(methodmsg)+1); + errMsg = (char*) MALLOC(strlen(methodmsg)+1); strcpy(errMsg,methodmsg); return(E_METHOD); } diff --git a/src/maths/ni/niiter.c b/src/maths/ni/niiter.c index c3a2b3b99..44e8c016c 100644 --- a/src/maths/ni/niiter.c +++ b/src/maths/ni/niiter.c @@ -189,7 +189,7 @@ NIiter(CKTcircuit *ckt, int maxIter) /*fprintf(stderr,"too many iterations without convergence: %d iter's (max iter == %d)\n", iterno,maxIter);*/ ckt->CKTstat->STATnumIter += iterno; - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); strcpy(errMsg,msg); #ifdef STEPDEBUG printf("iterlim exceeded \n"); diff --git a/src/misc/dstring.c b/src/misc/dstring.c index de31937cd..39fac66c0 100644 --- a/src/misc/dstring.c +++ b/src/misc/dstring.c @@ -4,7 +4,10 @@ DESCRIPTION:This file contains the routines for manipulating dynamic strings. CONTENTS: DATE: Wed Mar 24 18:38:28 CDT 2010 REVISIONS: $Log$ -REVISIONS: Revision 1.1 2010-03-25 22:44:38 dwarning +REVISIONS: Revision 1.2 2010-07-01 19:52:26 rlar +REVISIONS: cast the return values of malloc() function calls +REVISIONS: +REVISIONS: Revision 1.1 2010/03/25 22:44:38 dwarning REVISIONS: Bill Swartz patch REVISIONS: ----------------------------------------------------------------- */ @@ -84,7 +87,7 @@ char *spice_dstring_append(SPICE_DSTRINGPTR dsPtr,char *string,int length) ----------------------------------------------------------------- */ if (newSize >= dsPtr->spaceAvl) { dsPtr->spaceAvl = 2 * newSize ; - newString = tmalloc( dsPtr->spaceAvl * sizeof(char) ) ; + newString = (char*) tmalloc( dsPtr->spaceAvl * sizeof(char) ) ; memcpy((void *) newString, (void *) dsPtr->string, (size_t) dsPtr->length) ; if (dsPtr->string != dsPtr->staticSpace) { txfree(dsPtr->string) ; @@ -273,7 +276,7 @@ char *_spice_dstring_setlength(SPICE_DSTRINGPTR dsPtr,int length) if (length >= dsPtr->spaceAvl) { dsPtr->spaceAvl = length+1; - newString = tmalloc( dsPtr->spaceAvl * sizeof(char) ) ; + newString = (char*) tmalloc( dsPtr->spaceAvl * sizeof(char) ) ; /* ----------------------------------------------------------------- * SPECIAL NOTE: must use memcpy, not strcpy, to copy the string * to a larger buffer, since there may be embedded NULLs in the diff --git a/src/misc/string.c b/src/misc/string.c index de6ba331a..a91d72fd6 100644 --- a/src/misc/string.c +++ b/src/misc/string.c @@ -28,7 +28,7 @@ copy(const char *str) { char *p; - if ((p = tmalloc(strlen(str) + 1))) + if ((p = (char*) tmalloc(strlen(str) + 1))) (void) strcpy(p, str); return(p); } @@ -39,7 +39,7 @@ copy_substring(const char *str, const char *end) int n = end - str; char *p; - if ((p = tmalloc(n + 1))) { + if ((p = (char*) tmalloc(n + 1))) { (void) strncpy(p, str, n); p[n] = '\0'; } diff --git a/src/misc/util.c b/src/misc/util.c index f7f861ae1..930fa28d7 100644 --- a/src/misc/util.c +++ b/src/misc/util.c @@ -126,7 +126,7 @@ char * absolute_pathname(char *string, char *dot_path) result = copy(string); else { if (dot_path && dot_path[0]) { - result = tmalloc(2 + strlen(dot_path) + strlen(string)); + result = (char*) tmalloc(2 + strlen(dot_path) + strlen(string)); strcpy(result, dot_path); result_len = strlen(result); if (result[result_len - 1] != '/') { @@ -134,7 +134,7 @@ char * absolute_pathname(char *string, char *dot_path) result[result_len] = '\0'; } } else { - result = tmalloc(3 + strlen (string)); + result = (char*) tmalloc(3 + strlen (string)); result[0] = '.'; result[1] = '/'; result[2] = '\0'; result_len = 2; } diff --git a/src/misc/wlist.c b/src/misc/wlist.c index f52be138e..32eeb01d3 100644 --- a/src/misc/wlist.c +++ b/src/misc/wlist.c @@ -197,7 +197,7 @@ wl_flatten(wordlist *wl) for (tw = wl; tw; tw = tw->wl_next) i += strlen(tw->wl_word) + 1; - buf = tmalloc(i + 1); + buf = (char*) tmalloc(i + 1); *buf = 0; while (wl != NULL) { diff --git a/src/spicelib/analysis/ckttroub.c b/src/spicelib/analysis/ckttroub.c index afc83b9ad..184e29ce4 100644 --- a/src/spicelib/analysis/ckttroub.c +++ b/src/spicelib/analysis/ckttroub.c @@ -91,7 +91,7 @@ CKTtrouble(void *cktp, char *optmsg) sprintf(msg_p, "cause unrecorded.\n"); } - emsg = MALLOC(strlen(msg_buf)+1); + emsg = (char*) MALLOC(strlen(msg_buf)+1); strcpy(emsg,msg_buf); return emsg; diff --git a/src/spicelib/analysis/distoan.c b/src/spicelib/analysis/distoan.c index 218060323..2e0b93135 100644 --- a/src/spicelib/analysis/distoan.c +++ b/src/spicelib/analysis/distoan.c @@ -428,7 +428,7 @@ printf("Time outside D_2F1MF2: %g seconds \n", time); } else { - errMsg = MALLOC(strlen(nof2src)+1); + errMsg = (char*) MALLOC(strlen(nof2src)+1); strcpy(errMsg,nof2src); return(E_NOF2SRC); } diff --git a/src/spicelib/analysis/noisean.c b/src/spicelib/analysis/noisean.c index 5701255fc..b47299d2b 100644 --- a/src/spicelib/analysis/noisean.c +++ b/src/spicelib/analysis/noisean.c @@ -53,7 +53,7 @@ NOISEan (CKTcircuit *ckt, int restart) error = CKTfndDev((void *)ckt,&code,(void **)&inst, job->input, (void *)NULL, (IFuid)NULL); if (!error && !((VSRCinstance *)inst)->VSRCacGiven) { - errMsg = MALLOC(strlen(noacinput)+1); + errMsg = (char*) MALLOC(strlen(noacinput)+1); strcpy(errMsg,noacinput); return (E_NOACINPUT); } @@ -71,7 +71,7 @@ NOISEan (CKTcircuit *ckt, int restart) return (E_NOTFOUND); } if (!((ISRCinstance *)inst)->ISRCacGiven) { - errMsg = MALLOC(strlen(noacinput)+1); + errMsg = (char*) MALLOC(strlen(noacinput)+1); strcpy(errMsg,noacinput); return (E_NOACINPUT); } diff --git a/src/spicelib/devices/bjt/bjtask.c b/src/spicelib/devices/bjt/bjtask.c index 3f1088218..9800c11e0 100644 --- a/src/spicelib/devices/bjt/bjtask.c +++ b/src/spicelib/devices/bjt/bjtask.c @@ -228,7 +228,7 @@ BJTask(CKTcircuit *ckt, GENinstance *instPtr, int which, IFvalue *value, IFvalue return(OK); case BJT_QUEST_CS : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "BJTask"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -243,7 +243,7 @@ BJTask(CKTcircuit *ckt, GENinstance *instPtr, int which, IFvalue *value, IFvalue return(OK); case BJT_QUEST_CE : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "BJTask"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -258,7 +258,7 @@ BJTask(CKTcircuit *ckt, GENinstance *instPtr, int which, IFvalue *value, IFvalue return(OK); case BJT_QUEST_POWER : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "BJTask"; strcpy(errMsg,msg); return(E_ASKPOWER); diff --git a/src/spicelib/devices/bjt2/bjt2ask.c b/src/spicelib/devices/bjt2/bjt2ask.c index 935e92e09..a1b92e6d5 100644 --- a/src/spicelib/devices/bjt2/bjt2ask.c +++ b/src/spicelib/devices/bjt2/bjt2ask.c @@ -241,7 +241,7 @@ BJT2ask(CKTcircuit *ckt, GENinstance *instPtr, int which, IFvalue *value, return(OK); case BJT2_QUEST_CS : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "BJT2ask"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -259,7 +259,7 @@ BJT2ask(CKTcircuit *ckt, GENinstance *instPtr, int which, IFvalue *value, return(OK); case BJT2_QUEST_CE : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "BJT2ask"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -278,7 +278,7 @@ BJT2ask(CKTcircuit *ckt, GENinstance *instPtr, int which, IFvalue *value, return(OK); case BJT2_QUEST_POWER : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "BJT2ask"; strcpy(errMsg,msg); return(E_ASKPOWER); diff --git a/src/spicelib/devices/cap/capask.c b/src/spicelib/devices/cap/capask.c index 87e1c94d2..4af671504 100644 --- a/src/spicelib/devices/cap/capask.c +++ b/src/spicelib/devices/cap/capask.c @@ -53,7 +53,7 @@ CAPask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, return(OK); case CAP_CURRENT: if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "CAPask"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -72,7 +72,7 @@ CAPask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, return(OK); case CAP_POWER: if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "CAPask"; strcpy(errMsg,msg); return(E_ASKPOWER); diff --git a/src/spicelib/devices/cccs/cccsask.c b/src/spicelib/devices/cccs/cccsask.c index 6b9438156..c06846af6 100644 --- a/src/spicelib/devices/cccs/cccsask.c +++ b/src/spicelib/devices/cccs/cccsask.c @@ -47,7 +47,7 @@ CCCSask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue * return (OK); case CCCS_CURRENT : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "CCCSask"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -62,7 +62,7 @@ CCCSask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue * return(OK); case CCCS_POWER : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "CCCSask"; strcpy(errMsg,msg); return(E_ASKPOWER); diff --git a/src/spicelib/devices/ccvs/ccvsask.c b/src/spicelib/devices/ccvs/ccvsask.c index 2c3b775cf..4bdf880a7 100644 --- a/src/spicelib/devices/ccvs/ccvsask.c +++ b/src/spicelib/devices/ccvs/ccvsask.c @@ -48,7 +48,7 @@ CCVSask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue * return (OK); case CCVS_CURRENT : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "CCVSask"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -62,7 +62,7 @@ CCVSask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue * return(OK); case CCVS_POWER : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "CCVSask"; strcpy(errMsg,msg); return(E_ASKPOWER); diff --git a/src/spicelib/devices/cpl/cplsetup.c b/src/spicelib/devices/cpl/cplsetup.c index 04e77b033..3170d1345 100644 --- a/src/spicelib/devices/cpl/cplsetup.c +++ b/src/spicelib/devices/cpl/cplsetup.c @@ -215,7 +215,7 @@ if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NULL){\ branchname = (char **) tmalloc(sizeof(char *) * here->dimension); if (! here->CPLibr1Given) { for (m = 0; m < here->dimension; m++) { - branchname[m] = tmalloc(MAX_STRING); + branchname[m] = (char*) tmalloc(MAX_STRING); sprintf(branchname[m], "branch1_%d", m); error = CKTmkCur(ckt, &tmp, here->CPLname, branchname[m]); @@ -228,7 +228,7 @@ if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NULL){\ branchname = (char **) tmalloc(sizeof(char *) * here->dimension); if (! here->CPLibr2Given) { for (m = 0; m < here->dimension; m++) { - branchname[m] = tmalloc(MAX_STRING); + branchname[m] = (char*) tmalloc(MAX_STRING); sprintf(branchname[m], "branch2_%d", m); error = CKTmkCur(ckt, &tmp, here->CPLname, branchname[m]); @@ -513,7 +513,7 @@ ReadCpL(CPLinstance *here, CKTcircuit *ckt) for (i = 0; i < noL; i++) { if (c->taul[i] < ckt->CKTmaxStep) { - errMsg = tmalloc(strlen(message)+1); + errMsg = (char*) tmalloc(strlen(message)+1); strcpy(errMsg,message); return(-1); } diff --git a/src/spicelib/devices/csw/cswask.c b/src/spicelib/devices/csw/cswask.c index 4d0a79c49..4b33f4e85 100644 --- a/src/spicelib/devices/csw/cswask.c +++ b/src/spicelib/devices/csw/cswask.c @@ -37,7 +37,7 @@ CSWask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue *s return (OK); case CSW_CURRENT: if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "CSWask"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -49,7 +49,7 @@ CSWask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue *s return(OK); case CSW_POWER: if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "CSWask"; strcpy(errMsg,msg); return(E_ASKPOWER); diff --git a/src/spicelib/devices/dio/dioask.c b/src/spicelib/devices/dio/dioask.c index 2ca82d4a9..b99ab0a6d 100644 --- a/src/spicelib/devices/dio/dioask.c +++ b/src/spicelib/devices/dio/dioask.c @@ -69,7 +69,7 @@ DIOask (CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, return(OK); case DIO_POWER : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "DIOask"; strcpy(errMsg,msg); return(E_ASKPOWER); diff --git a/src/spicelib/devices/dio/diotemp.c b/src/spicelib/devices/dio/diotemp.c index fb2036cf4..4998717e6 100644 --- a/src/spicelib/devices/dio/diotemp.c +++ b/src/spicelib/devices/dio/diotemp.c @@ -171,7 +171,7 @@ DIOtemp(GENmodel *inModel, CKTcircuit *ckt) model->DIObreakdownVoltage/vt) { cbv=here->DIOtSatCur*here->DIOarea*here->DIOm * model->DIObreakdownVoltage/vt; - emsg = MALLOC(100); + emsg = (char*) MALLOC(100); if(emsg == (char *)NULL) return(E_NOMEM); (void)sprintf(emsg, "%%s: breakdown current increased to %g to resolve", @@ -193,7 +193,7 @@ DIOtemp(GENmodel *inModel, CKTcircuit *ckt) (exp((model->DIObreakdownVoltage-xbv)/vt)-1+xbv/vt); if (fabs(xcbv-cbv) <= tol) goto matched; } - emsg = MALLOC(100); + emsg = (char*) MALLOC(100); if(emsg == (char *)NULL) return(E_NOMEM); (void)sprintf(emsg, "%%s: unable to match forward and reverse diode regions: bv = %g, ibv = %g", diff --git a/src/spicelib/devices/hfet1/hfetask.c b/src/spicelib/devices/hfet1/hfetask.c index edd132010..01d9ad5e1 100644 --- a/src/spicelib/devices/hfet1/hfetask.c +++ b/src/spicelib/devices/hfet1/hfetask.c @@ -114,7 +114,7 @@ HFETAask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue return (OK); case HFETA_CS : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "HFETAask"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -126,7 +126,7 @@ HFETAask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue return(OK); case HFETA_POWER : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "HFETAask"; strcpy(errMsg,msg); return(E_ASKPOWER); diff --git a/src/spicelib/devices/hfet2/hfet2ask.c b/src/spicelib/devices/hfet2/hfet2ask.c index 32310d56a..3ec5d8a5d 100644 --- a/src/spicelib/devices/hfet2/hfet2ask.c +++ b/src/spicelib/devices/hfet2/hfet2ask.c @@ -109,7 +109,7 @@ HFET2ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, return (OK); case HFET2_CS : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "HFET2ask"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -121,7 +121,7 @@ HFET2ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, return(OK); case HFET2_POWER : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "HFET2ask"; strcpy(errMsg,msg); return(E_ASKPOWER); diff --git a/src/spicelib/devices/ind/indask.c b/src/spicelib/devices/ind/indask.c index f25f81d71..86a1af322 100644 --- a/src/spicelib/devices/ind/indask.c +++ b/src/spicelib/devices/ind/indask.c @@ -52,7 +52,7 @@ INDask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, return(OK); case IND_CURRENT : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "INDask"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -62,7 +62,7 @@ INDask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, return(OK); case IND_POWER : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "INDask"; strcpy(errMsg,msg); return(E_ASKPOWER); diff --git a/src/spicelib/devices/isrc/isrcask.c b/src/spicelib/devices/isrc/isrcask.c index 4039cbe72..d9f74466e 100644 --- a/src/spicelib/devices/isrc/isrcask.c +++ b/src/spicelib/devices/isrc/isrcask.c @@ -76,7 +76,7 @@ ISRCask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue * return(OK); case ISRC_POWER: if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "ISRCask"; strcpy(errMsg,msg); return(E_ASKPOWER); diff --git a/src/spicelib/devices/jfet/jfetask.c b/src/spicelib/devices/jfet/jfetask.c index bb6762a7c..6af9f47b5 100644 --- a/src/spicelib/devices/jfet/jfetask.c +++ b/src/spicelib/devices/jfet/jfetask.c @@ -112,7 +112,7 @@ JFETask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, return(OK); case JFET_CS : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "JFETask"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -124,7 +124,7 @@ JFETask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, return(OK); case JFET_POWER : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "JFETask"; strcpy(errMsg,msg); return(E_ASKPOWER); diff --git a/src/spicelib/devices/jfet2/jfet2ask.c b/src/spicelib/devices/jfet2/jfet2ask.c index 8216d20ac..7df770b49 100644 --- a/src/spicelib/devices/jfet2/jfet2ask.c +++ b/src/spicelib/devices/jfet2/jfet2ask.c @@ -121,7 +121,7 @@ JFET2ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, return(OK); case JFET2_CS : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "JFET2ask"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -133,7 +133,7 @@ JFET2ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, return(OK); case JFET2_POWER : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "JFET2ask"; strcpy(errMsg,msg); return(E_ASKPOWER); diff --git a/src/spicelib/devices/mes/mesask.c b/src/spicelib/devices/mes/mesask.c index 678ca082d..d63522f0d 100644 --- a/src/spicelib/devices/mes/mesask.c +++ b/src/spicelib/devices/mes/mesask.c @@ -98,7 +98,7 @@ MESask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue *s return (OK); case MES_CS : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "MESask"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -110,7 +110,7 @@ MESask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue *s return(OK); case MES_POWER : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "MESask"; strcpy(errMsg,msg); return(E_ASKPOWER); diff --git a/src/spicelib/devices/mesa/mesaask.c b/src/spicelib/devices/mesa/mesaask.c index a7a4dbe62..3f319f096 100644 --- a/src/spicelib/devices/mesa/mesaask.c +++ b/src/spicelib/devices/mesa/mesaask.c @@ -120,7 +120,7 @@ MESAask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue * return (OK); case MESA_CS : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "MESAask"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -132,7 +132,7 @@ MESAask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue * return(OK); case MESA_POWER : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "MESAask"; strcpy(errMsg,msg); return(E_ASKPOWER); diff --git a/src/spicelib/devices/mos1/mos1ask.c b/src/spicelib/devices/mos1/mos1ask.c index 3f84397cc..9810c8553 100644 --- a/src/spicelib/devices/mos1/mos1ask.c +++ b/src/spicelib/devices/mos1/mos1ask.c @@ -353,7 +353,7 @@ MOS1ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, return(OK); case MOS1_CB : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "MOS1ask.c"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -364,7 +364,7 @@ MOS1ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, return(OK); case MOS1_CG : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "MOS1ask.c"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -381,7 +381,7 @@ MOS1ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, return(OK); case MOS1_CS : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "MOS1ask.c"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -399,7 +399,7 @@ MOS1ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, return(OK); case MOS1_POWER : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "MOS1ask.c"; strcpy(errMsg,msg); return(E_ASKPOWER); diff --git a/src/spicelib/devices/mos2/mos2ask.c b/src/spicelib/devices/mos2/mos2ask.c index a5ee7d864..c82add430 100644 --- a/src/spicelib/devices/mos2/mos2ask.c +++ b/src/spicelib/devices/mos2/mos2ask.c @@ -353,7 +353,7 @@ MOS2ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, return(OK); case MOS2_CB : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "MOS2ask.c"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -364,7 +364,7 @@ MOS2ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, return(OK); case MOS2_CG : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "MOS2ask.c"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -381,7 +381,7 @@ MOS2ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, return(OK); case MOS2_CS : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "MOS2ask.c"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -399,7 +399,7 @@ MOS2ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, return(OK); case MOS2_POWER : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "MOS2ask.c"; strcpy(errMsg,msg); return(E_ASKPOWER); diff --git a/src/spicelib/devices/mos3/mos3ask.c b/src/spicelib/devices/mos3/mos3ask.c index ef413f9dd..636fbb9cb 100644 --- a/src/spicelib/devices/mos3/mos3ask.c +++ b/src/spicelib/devices/mos3/mos3ask.c @@ -358,7 +358,7 @@ MOS3ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, return(OK); case MOS3_CB : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "MOS3ask.c"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -369,7 +369,7 @@ MOS3ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, return(OK); case MOS3_CG : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "MOS3ask.c"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -386,7 +386,7 @@ MOS3ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, return(OK); case MOS3_CS : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "MOS3ask.c"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -404,7 +404,7 @@ MOS3ask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, return(OK); case MOS3_POWER : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "MOS3ask.c"; strcpy(errMsg,msg); return(E_ASKPOWER); diff --git a/src/spicelib/devices/mos6/mos6ask.c b/src/spicelib/devices/mos6/mos6ask.c index e8573030c..4d6fb5141 100644 --- a/src/spicelib/devices/mos6/mos6ask.c +++ b/src/spicelib/devices/mos6/mos6ask.c @@ -386,7 +386,7 @@ MOS6ask(CKTcircuit *ckt, GENinstance *inst, int which, return(OK); case MOS6_CB : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "MOS6ask.c"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -398,7 +398,7 @@ MOS6ask(CKTcircuit *ckt, GENinstance *inst, int which, return(OK); case MOS6_CG : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "MOS6ask.c"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -416,7 +416,7 @@ MOS6ask(CKTcircuit *ckt, GENinstance *inst, int which, return(OK); case MOS6_CS : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "MOS6ask.c"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -435,7 +435,7 @@ MOS6ask(CKTcircuit *ckt, GENinstance *inst, int which, return(OK); case MOS6_POWER : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "MOS6ask.c"; strcpy(errMsg,msg); return(E_ASKPOWER); diff --git a/src/spicelib/devices/mos9/mos9ask.c b/src/spicelib/devices/mos9/mos9ask.c index cca6a1616..834468ffa 100644 --- a/src/spicelib/devices/mos9/mos9ask.c +++ b/src/spicelib/devices/mos9/mos9ask.c @@ -355,7 +355,7 @@ MOS9ask(CKTcircuit *ckt, GENinstance *inst, int which, return(OK); case MOS9_CB : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "MOS9ask.c"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -366,7 +366,7 @@ MOS9ask(CKTcircuit *ckt, GENinstance *inst, int which, return(OK); case MOS9_CG : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "MOS9ask.c"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -383,7 +383,7 @@ MOS9ask(CKTcircuit *ckt, GENinstance *inst, int which, return(OK); case MOS9_CS : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "MOS9ask.c"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -401,7 +401,7 @@ MOS9ask(CKTcircuit *ckt, GENinstance *inst, int which, return(OK); case MOS9_POWER : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "MOS9ask.c"; strcpy(errMsg,msg); return(E_ASKPOWER); diff --git a/src/spicelib/devices/res/resask.c b/src/spicelib/devices/res/resask.c index 66b8b1138..8774bd53d 100644 --- a/src/spicelib/devices/res/resask.c +++ b/src/spicelib/devices/res/resask.c @@ -135,7 +135,7 @@ RESask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, return(OK); case RES_CURRENT: if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "RESask"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -148,7 +148,7 @@ RESask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, return(OK); case RES_POWER: if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "RESask"; strcpy(errMsg,msg); return(E_ASKPOWER); diff --git a/src/spicelib/devices/sw/swask.c b/src/spicelib/devices/sw/swask.c index cd59ed2ae..dc43bebe9 100644 --- a/src/spicelib/devices/sw/swask.c +++ b/src/spicelib/devices/sw/swask.c @@ -41,7 +41,7 @@ SWask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue *se return (OK); case SW_CURRENT: if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "SWask"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -53,7 +53,7 @@ SWask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue *se return(OK); case SW_POWER: if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "SWask"; strcpy(errMsg,msg); return(E_ASKPOWER); diff --git a/src/spicelib/devices/vccs/vccsask.c b/src/spicelib/devices/vccs/vccsask.c index 7b37a5ce8..8961a2aea 100644 --- a/src/spicelib/devices/vccs/vccsask.c +++ b/src/spicelib/devices/vccs/vccsask.c @@ -108,7 +108,7 @@ VCCSask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue * return(OK); case VCCS_CURRENT: if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "VCCSask"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -124,7 +124,7 @@ VCCSask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue * return (OK); case VCCS_POWER: if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "VCCSask"; strcpy(errMsg,msg); return(E_ASKPOWER); diff --git a/src/spicelib/devices/vcvs/vcvsask.c b/src/spicelib/devices/vcvs/vcvsask.c index 59dc0ff7c..0228360df 100644 --- a/src/spicelib/devices/vcvs/vcvsask.c +++ b/src/spicelib/devices/vcvs/vcvsask.c @@ -116,7 +116,7 @@ VCVSask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue * return(OK); case VCVS_CURRENT : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "VCVSask"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -130,7 +130,7 @@ VCVSask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue * return(OK); case VCVS_POWER : if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "VCVSask"; strcpy(errMsg,msg); return(E_ASKPOWER); diff --git a/src/spicelib/devices/vsrc/vsrcask.c b/src/spicelib/devices/vsrc/vsrcask.c index d4ac4ea3c..799be48a4 100644 --- a/src/spicelib/devices/vsrc/vsrcask.c +++ b/src/spicelib/devices/vsrc/vsrcask.c @@ -86,7 +86,7 @@ VSRCask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue * return (OK); case VSRC_CURRENT: if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "VSRCask"; strcpy(errMsg,msg); return(E_ASKCURRENT); @@ -96,7 +96,7 @@ VSRCask(CKTcircuit *ckt, GENinstance *inst, int which, IFvalue *value, IFvalue * return(OK); case VSRC_POWER: if (ckt->CKTcurrentAnalysis & DOING_AC) { - errMsg = MALLOC(strlen(msg)+1); + errMsg = (char*) MALLOC(strlen(msg)+1); errRtn = "VSRCask"; strcpy(errMsg,msg); return(E_ASKPOWER); diff --git a/src/spicelib/parser/inp2r.c b/src/spicelib/parser/inp2r.c index 589daa3a6..e46e4b882 100644 --- a/src/spicelib/parser/inp2r.c +++ b/src/spicelib/parser/inp2r.c @@ -125,7 +125,7 @@ void INP2R(void *ckt, INPtables * tab, card * current) /* first alocate memory for the new longer line */ i = strlen(current->line); /* length of existing line */ - line = tmalloc(i + 4 + 1); /* alocate enough for "tc2=" & terminating NULL */ + line = (char*) tmalloc(i + 4 + 1); /* alocate enough for "tc2=" & terminating NULL */ if(line == NULL) { /* failed to allocate memory so we recover rather crudely by rejecting the translation */ diff --git a/src/spicelib/parser/inpdpar.c b/src/spicelib/parser/inpdpar.c index 37a723fc4..6caed485f 100644 --- a/src/spicelib/parser/inpdpar.c +++ b/src/spicelib/parser/inpdpar.c @@ -79,7 +79,7 @@ char *INPdevParse(char **line, void *ckt, int dev, void *fast, } } if (i == (*(*(ft_sim->devices)[dev]).numInstanceParms)) { - errbuf = MALLOC(strlen(parm) + 25); + errbuf = (char*) MALLOC(strlen(parm) + 25); (void) sprintf(errbuf, " unknown parameter (%s) \n", parm); rtn = (errbuf); goto quit; diff --git a/src/spicelib/parser/inpmktmp.c b/src/spicelib/parser/inpmktmp.c index 1ed44d65e..5855cd652 100644 --- a/src/spicelib/parser/inpmktmp.c +++ b/src/spicelib/parser/inpmktmp.c @@ -17,7 +17,7 @@ char *INPmkTemp(char *string) char *temp; len = strlen(string); - temp = MALLOC(len + 1); + temp = (char*) MALLOC(len + 1); if (temp != (char *) NULL) (void) strcpy(temp, string); return (temp); diff --git a/src/spicelib/parser/inpptree.c b/src/spicelib/parser/inpptree.c index 0585da414..fddbaf4aa 100644 --- a/src/spicelib/parser/inpptree.c +++ b/src/spicelib/parser/inpptree.c @@ -844,7 +844,7 @@ static INPparseNode *mkfnode(const char *fname, INPparseNode * arg) p = (INPparseNode *) MALLOC(sizeof(INPparseNode)); if (!strcmp(buf, "v")) { - name = MALLOC(128); + name = (char*) MALLOC(128); if (arg->type == PT_PLACEHOLDER) { strcpy(name, arg->funcname); } else if (arg->type == PT_CONSTANT) { @@ -883,7 +883,7 @@ static INPparseNode *mkfnode(const char *fname, INPparseNode * arg) p->type = PT_VAR; } } else if (!strcmp(buf, "i")) { - name = MALLOC(128); + name = (char*) MALLOC(128); if (arg->type == PT_PLACEHOLDER) strcpy(name, arg->funcname); else if (arg->type == PT_CONSTANT) @@ -1027,7 +1027,7 @@ static INPparseNode *mksnode(const char *string, void *ckt) values = (IFvalue *) MALLOC(sizeof(IFvalue)); types = (int *) MALLOC(sizeof(int)); } - values[i].sValue = MALLOC(strlen(buf) + 1); + values[i].sValue = (char*) MALLOC(strlen(buf) + 1); strcpy(values[i].sValue, buf); types[i] = IF_STRING; numvalues++; @@ -1176,7 +1176,7 @@ int PTlex (YYSTYPE *lvalp, char **line) for (s = sbuf; *s; s++) if (index(specials, *s)) break; - tmp = MALLOC(s - sbuf + 1); + tmp = (char*) MALLOC(s - sbuf + 1); strncpy(tmp, sbuf, s - sbuf); tmp[s - sbuf] = '\0'; lvalp->str = tmp;