Merge branch 'pre-master' of ssh://git.code.sf.net/p/ngspice/ngspice into beta_jdm

This commit is contained in:
Jim Monte 2019-12-10 00:15:55 -05:00
commit 01b8dd7d92
1 changed files with 22 additions and 1 deletions

View File

@ -224,6 +224,25 @@ NON-STANDARD FEATURES
==============================================================================*/
static void
cm_pwl_callback(ARGS, Mif_Callback_Reason_t reason)
{
switch (reason) {
case MIF_CB_DESTROY: {
double *last_x_value = STATIC_VAR (last_x_value);
double *x = STATIC_VAR (x);
double *y = STATIC_VAR (y);
free(last_x_value);
free(x);
free(y);
STATIC_VAR (last_x_value) = NULL;
STATIC_VAR (x) = NULL;
STATIC_VAR (y) = NULL;
break;
}
}
}
/*=== CM_PWL ROUTINE ================*/
void cm_pwl(ARGS) /* structure holding parms,
@ -250,7 +269,9 @@ void cm_pwl(ARGS) /* structure holding parms,
double test; /* temp storage variable for limit testing */
Mif_Complex_t ac_gain;
CALLBACK = cm_pwl_callback;
char *allocation_error="\n***ERROR***\nPWL: Allocation calloc failed!\n";
char *limit_error="\n***ERROR***\nPWL: Violation of 50% rule in breakpoints!\n";