Resolution of merge conflicts with pre-master: txfree()->free() in code models.

This commit is contained in:
Jim Monte 2020-02-22 01:27:24 -05:00
parent 69c6fd72da
commit bc5fc3ff0f
13 changed files with 48 additions and 54 deletions

View File

@ -11,12 +11,6 @@ static void no_free(const void *p) {
}
#endif
/* Returns the version string for ngspice */
static const char *get_ngspice_version(void)
{
const char *buf = VERSION;
return buf;
} /* end of function get_ngspice_version */
/* Returns stdout, stdin, and stderr */

View File

@ -227,7 +227,7 @@ void cm_filesource(ARGS) /* structure holding parms, inputs, outputs, etc.
else {
sprintf(p, "%s%s%s", lbuffer, DIR_PATHSEP, PARAM(file));
loc->state->fp = fopen(p, "r");
txfree(p);
free(p);
}
}
if (!loc->state->fp) {
@ -260,12 +260,12 @@ void cm_filesource(ARGS) /* structure holding parms, inputs, outputs, etc.
while (*cp && isspace_c(*cp))
++cp;
if (*cp == '*' || *cp == '#' || *cp == ';') {
txfree(cpdel);
free(cpdel);
continue;
}
t = strtod(cp, &cp2);
if (cp2 == cp) {
txfree(cpdel);
free(cpdel);
continue;
}
cp = cp2;
@ -306,7 +306,7 @@ void cm_filesource(ARGS) /* structure holding parms, inputs, outputs, etc.
t += PARAM(amploffset[i]);
loc->indata->datavec[count++] = t;
}
txfree(cpdel);
free(cpdel);
}
loc->indata->maxoccupied = count;
@ -381,25 +381,25 @@ static void cm_filesource_callback(ARGS, Mif_Callback_Reason_t reason)
if (loc->state->fp != (FILE *) NULL) {
fclose(loc->state->fp);
}
txfree(loc->state);
free(loc->state);
}
if (loc->amplinterval != (double *) NULL) {
txfree(loc->amplinterval);
free(loc->amplinterval);
}
if (loc->timeinterval != (double *) NULL) {
txfree(loc->timeinterval);
free(loc->timeinterval);
}
if (loc->indata) {
if (loc->indata->datavec) {
txfree(loc->indata->datavec);
free(loc->indata->datavec);
}
txfree(loc->indata);
free(loc->indata);
}
txfree(loc);
free(loc);
STATIC_VAR(locdata) = NULL;
break;

View File

@ -572,9 +572,9 @@ static void cm_oneshot_callback(ARGS, Mif_Callback_Reason_t reason)
if (loc == (Local_Data_t *) NULL) {
break;
}
txfree(loc->control);
txfree(loc->pw);
txfree(loc);
free(loc->control);
free(loc->pw);
free(loc);
STATIC_VAR(locdata) = (Local_Data_t *) NULL;
break;
}

View File

@ -231,17 +231,17 @@ cm_pwl_callback(ARGS, Mif_Callback_Reason_t reason)
case MIF_CB_DESTROY: {
void *p = STATIC_VAR(last_x_value);
if (p != NULL) {
txfree(p);
free(p);
}
p = STATIC_VAR(x);
if (p != NULL) {
txfree(p);
free(p);
}
p = STATIC_VAR(y);
if (p != NULL) {
txfree(p);
free(p);
}
STATIC_VAR (last_x_value) = NULL;

View File

@ -620,22 +620,22 @@ void cm_s_xfer(ARGS) /* structure holding parms, inputs, outputs, etc. */
EXITPOINT:
/* free all allocated memory */
if (old_integrator != (double **) NULL) {
txfree(old_integrator);
free(old_integrator);
}
if (integrator != (double **) NULL) {
txfree(integrator);
free(integrator);
}
if (den_coefficient != (double **) NULL) {
txfree(den_coefficient);
free(den_coefficient);
}
if (old_den_coefficient != (double **) NULL) {
txfree(old_den_coefficient);
free(old_den_coefficient);
}
if (num_coefficient != (double **) NULL) {
txfree(num_coefficient);
free(num_coefficient);
}
if (old_num_coefficient != (double **) NULL) {
txfree(old_num_coefficient);
free(old_num_coefficient);
}
} /* end of function cm_s_xfer */

View File

@ -407,7 +407,7 @@ static void cm_d_genlut_callback(ARGS, Mif_Callback_Reason_t reason)
case MIF_CB_DESTROY: {
void * const p = STATIC_VAR(locdata);
if (p != NULL) {
txfree(p);
free(p);
}
break;
}

View File

@ -269,7 +269,7 @@ static void cm_d_lut_callback(ARGS, Mif_Callback_Reason_t reason)
case MIF_CB_DESTROY: {
void * const p = STATIC_VAR(locdata);
if (p != NULL) {
txfree(p);
free(p);
}
break;
}

View File

@ -286,7 +286,7 @@ void cm_d_osc(ARGS)
y = (double *) calloc((size_t) freq_size, sizeof(double));
if (!y) {
cm_message_send(d_osc_allocation_error);
txfree(x);
free(x);
return;
}
@ -394,8 +394,8 @@ void cm_d_osc(ARGS)
txfree(x);
txfree(y);
free(x);
free(y);
}

View File

@ -183,7 +183,7 @@ static char *CNVgettok(char **s)
switch(**s) {
case '\0': /* End of string found */
txfree(buf);
free(buf);
return (char *) NULL;
default: /* Otherwise, we are dealing with a */
@ -220,7 +220,7 @@ static char *CNVgettok(char **s)
return (char *) NULL;
}
strcpy(ret_str, buf);
txfree(buf);
free(buf);
return ret_str;
}
@ -737,7 +737,7 @@ static int cm_read_source(FILE *source, Local_Data_t *loc)
while ( type != CNV_NO_TOK ) {
token = CNVget_token(&s, &type);
if (token)
txfree(token);
free(token);
j++;
}
num_tokens = j;
@ -813,7 +813,7 @@ static int cm_read_source(FILE *source, Local_Data_t *loc)
}
}
if (token)
txfree(token);
free(token);
}
i++;
}
@ -945,7 +945,7 @@ void cm_d_source(ARGS)
}
sprintf(p, "%s%s%s", lbuffer, DIR_PATHSEP, PARAM(input_file));
source = fopen(p, "r");
txfree(p);
free(p);
}
if (!source)
cm_message_printf("cannot open file %s", PARAM(input_file));
@ -1229,10 +1229,10 @@ static void free_local_data(Local_Data_t *loc)
int i;
for (i = 0; i != n; ++i) { /* free individual allocs */
if (all_data[i] != (char *) NULL) {
txfree(all_data[i]);
free(all_data[i]);
}
}
txfree(all_data);
free(all_data);
}
}
@ -1240,11 +1240,11 @@ static void free_local_data(Local_Data_t *loc)
{
void * const p = loc->all_timepoints;
if (p != NULL) {
txfree(p);
free(p);
}
}
txfree(loc);
free(loc);
} /* end of function free_local_data */

View File

@ -225,7 +225,7 @@ static char *CNVgettok(char **s)
switch(**s) {
case '\0': /* End of string found */
txfree(buf);
free(buf);
return (char *) NULL;
default: /* Otherwise, we are dealing with a */
@ -262,7 +262,7 @@ static char *CNVgettok(char **s)
return (char *) NULL;
}
strcpy(ret_str, buf);
txfree(buf);
free(buf);
return ret_str;
}
@ -2136,19 +2136,19 @@ static void free_state_fields(State_Table_t *p_state)
{
void *p;
if ((p = p_state->state) != NULL) {
txfree(p);
free(p);
p_state->state = (int *) NULL;
}
if ((p = p_state->bits) != NULL) {
txfree(p);
free(p);
p_state->bits = (short *) NULL;
}
if ((p = p_state->inputs) != NULL) {
txfree(p);
free(p);
p_state->inputs = (short *) NULL;
}
if ((p = p_state->next_state) != NULL) {
txfree(p);
free(p);
p_state->next_state = (int *) NULL;
}
} /* end of function free_state_fields */

View File

@ -75,7 +75,7 @@ cm_spice2poly_callback(ARGS, Mif_Callback_Reason_t reason)
case MIF_CB_DESTROY: {
Mif_Inst_Var_Data_t *p = STATIC_VAR_INST(acgains);
if(p->element) {
txfree(p->element);
free(p->element);
p->element = NULL;
}
break;
@ -234,13 +234,13 @@ void spice2poly (ARGS)
/* Free the allocated items and return */
EXITPOINT:
if (in != (double *) NULL) {
txfree(in);
free(in);
}
if (coef != (double *) NULL) {
txfree(coef);
free(coef);
}
if (exp != (int *) NULL) {
txfree(exp);
free(exp);
}
return;

View File

@ -94,7 +94,7 @@ static void cm_sidiode_callback(ARGS, Mif_Callback_Reason_t reason)
case MIF_CB_DESTROY: {
Local_Data_t *loc = (Local_Data_t *) STATIC_VAR(locdata);
if (loc != (Local_Data_t *) NULL) {
txfree(loc);
free(loc);
}
break;
}

View File

@ -372,7 +372,7 @@ static void cm_zener_callback(ARGS, Mif_Callback_Reason_t reason)
double * const p_prev_voltage =
(double *) STATIC_VAR(previous_voltage);
if (p_prev_voltage != (double *) NULL) {
txfree(p_prev_voltage);
free(p_prev_voltage);
}
break;
}