diff --git a/src/frontend/device.c b/src/frontend/device.c index 12fba6d1f..1fa48841e 100644 --- a/src/frontend/device.c +++ b/src/frontend/device.c @@ -293,7 +293,7 @@ all_show(wordlist *wl, int mode) if (eq(w->wl_word, "*")) { tfree(w->wl_word); - w->wl_word = strdup("all"); + w->wl_word = copy("all"); } if (eq(w->wl_word, "++") || eq(w->wl_word, "all")) { @@ -454,7 +454,7 @@ all_show_old(wordlist *wl, int mode) if (eq(w->wl_word, "*")) { tfree(w->wl_word); - w->wl_word = strdup("all"); + w->wl_word = copy("all"); } if (eq(w->wl_word, "++") || eq(w->wl_word, "all")) { diff --git a/src/frontend/inp.c b/src/frontend/inp.c index 04729a67f..b949b30ea 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -482,7 +482,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) s = skip_ws(dd->line + 5); if (temperature) txfree(temperature); - temperature = strdup(s); + temperature = copy(s); } /* Ignore comment lines, but not lines begining with '*#', but remove them, if they are in a .control ... .endc section */ diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 5956caebf..c4f6516f9 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -312,7 +312,7 @@ read_a_lib(char *y, char *dir_name) /* lib points to a new entry in global lib array libraries[N_LIBRARIES] */ lib = new_lib(); - lib->realpath = strdup(yy); + lib->realpath = copy(yy); lib->habitat = ngdirname(yy); lib->deck = inp_read(newfp, 1 /*dummy*/, lib->habitat, FALSE, FALSE) . cc; @@ -2317,7 +2317,7 @@ inp_fix_subckt(struct names *subckt_w_params, char *s) new_str = NULL; for (c = head->nextcard; c; c = c->nextcard) if (new_str == NULL) { - new_str = strdup(c->line); + new_str = copy(c->line); } else { char *x = tprintf("%s %s", new_str, c->line); tfree(new_str); @@ -2668,7 +2668,7 @@ inp_fix_inst_line(char *inst_line, for (j = 0; j < num_inst_params; j++) if (strcmp(subckt_param_names[i], inst_param_names[j]) == 0) { tfree(subckt_param_values[i]); - subckt_param_values[i] = strdup(inst_param_values[j]); + subckt_param_values[i] = copy(inst_param_values[j]); } for (i = 0; i < num_subckt_params; i++) { @@ -2721,8 +2721,8 @@ inp_fix_subckt_multiplier(struct names *subckt_w_params, struct card *subckt_car struct card *card; char *new_str; - subckt_param_names[num_subckt_params] = strdup("m"); - subckt_param_values[num_subckt_params] = strdup("1"); + subckt_param_names[num_subckt_params] = copy("m"); + subckt_param_values[num_subckt_params] = copy("1"); num_subckt_params ++; if (!strstr(subckt_card->line, "params:")) { @@ -3106,7 +3106,7 @@ search_func_arg(char *str, struct function *fcn, int *which, char *str_begin) static char* inp_do_macro_param_replace(struct function *fcn, char *params[]) { - char *str = strdup(fcn->body); + char *str = copy(fcn->body); int i; char *collect_ptr = NULL; @@ -3178,7 +3178,7 @@ inp_expand_macro_in_str(struct function_env *env, char *str) char *open_paren_ptr, *close_paren_ptr, *fcn_name, *params[1000]; char *curr_ptr, *macro_str, *curr_str = NULL; int num_params, i; - char *orig_ptr = str, *search_ptr = str, *orig_str = strdup(str); + char *orig_ptr = str, *search_ptr = str, *orig_str = copy(str); char keep; // printf("%s: enter(\"%s\")\n", __FUNCTION__, str); @@ -3847,8 +3847,8 @@ inp_sort_params(struct card *param_cards, struct card *card_bf_start, struct car deps[num_params].depends_on[0] = NULL; deps[num_params].level = -1; deps[num_params].skip = 0; - deps[num_params].param_name = get_param_name(c->line); /* strdup in fcn */ - deps[num_params].param_str = strdup(get_param_str(c->line)); + deps[num_params].param_name = get_param_name(c->line); /* copy in fcn */ + deps[num_params].param_str = copy(get_param_str(c->line)); deps[num_params].card = c; num_params ++; } diff --git a/src/frontend/measure.c b/src/frontend/measure.c index 94b300cfc..7dea2d5a5 100644 --- a/src/frontend/measure.c +++ b/src/frontend/measure.c @@ -225,7 +225,7 @@ do_measure( SetAnalyse("meas", 0); #endif - an_name = strdup(what); /* analysis type, e.g. "tran" */ + an_name = copy(what); /* analysis type, e.g. "tran" */ strtolower(an_name); measure_word_list = NULL; measures_passed = TRUE; @@ -333,7 +333,7 @@ do_measure( if (!chk_only) { newcard = TMALLOC(struct card, 1); - newcard->line = strdup(out_line); + newcard->line = copy(out_line); newcard->nextcard = NULL; if (meas_results == NULL) { diff --git a/src/frontend/mw_coms.c b/src/frontend/mw_coms.c index 7f01a262d..9b6a7bdc5 100644 --- a/src/frontend/mw_coms.c +++ b/src/frontend/mw_coms.c @@ -49,7 +49,7 @@ com_removecirc(wordlist *wl) ct->ci_vars = NULL; caux = ft_circuits; - namecircuit = strdup(ft_curckt->ci_name); + namecircuit = copy(ft_curckt->ci_name); /* The circuit being removed is the first loaded and you have more circuits */ if (ft_curckt == ft_circuits && ft_circuits->ci_next) diff --git a/src/frontend/numparam/spicenum.c b/src/frontend/numparam/spicenum.c index 2851423ae..a9bc48664 100644 --- a/src/frontend/numparam/spicenum.c +++ b/src/frontend/numparam/spicenum.c @@ -598,7 +598,7 @@ nupa_copy(struct card *deck) dicoS->dyncategory[linenum] = c; } /* keep a local copy and mangle the string */ - t = strdup(spice_dstring_value(&u)); + t = copy(spice_dstring_value(&u)); if (!t) { fputs("Fatal: String malloc crash in nupa_copy()\n", stderr); diff --git a/src/frontend/numparam/xpressn.c b/src/frontend/numparam/xpressn.c index 1ee03ff7d..40c4eaad5 100644 --- a/src/frontend/numparam/xpressn.c +++ b/src/frontend/numparam/xpressn.c @@ -409,7 +409,7 @@ attrib(dico_t *dico, NGHASHPTR htable_p, char *t, char op) if (!entry) { entry = TMALLOC(entry_t, 1); - entry->symbol = strdup(t); + entry->symbol = copy(t); entry->tp = NUPA_UNKNOWN; /* signal Unknown */ entry->level = dico->stack_depth; nghash_insert(htable_p, t, entry);