mif/mifdelete.c, fix commit: xspice, implement "CALLBACK"

MIFdelete() might be called with third arg being NULL,
  searching for the instance to be deleted by name only.
Need to invoke the callback in this case too.
This commit is contained in:
rlar 2018-01-07 19:21:52 +01:00
parent e311096429
commit fbc1f37b36
1 changed files with 18 additions and 15 deletions

View File

@ -89,21 +89,6 @@ MIFdelete(
model = (MIFmodel *) inModel;
fast = (MIFinstance **) inst;
if ((*fast)->callback) {
Mif_Private_t cm_data;
/* Prepare the structure to be passed to the code model */
cm_data.num_conn = (*fast)->num_conn;
cm_data.conn = (*fast)->conn;
cm_data.num_param = (*fast)->num_param;
cm_data.param = (*fast)->param;
cm_data.num_inst_var = (*fast)->num_inst_var;
cm_data.inst_var = (*fast)->inst_var;
cm_data.callback = &((*fast)->callback);
(*fast)->callback(&cm_data, MIF_CB_DESTROY);
}
/*******************************************/
/* Cut the instance out of the linked list */
/*******************************************/
@ -129,6 +114,24 @@ MIFdelete(
if(!found)
return(E_NODEV);
/*******************************************/
/* instance->callback(..., MIF_CB_DESTROY) */
/*******************************************/
if (here->callback) {
Mif_Private_t cm_data;
/* Prepare the structure to be passed to the code model */
cm_data.num_conn = here->num_conn;
cm_data.conn = here->conn;
cm_data.num_param = here->num_param;
cm_data.param = here->param;
cm_data.num_inst_var = here->num_inst_var;
cm_data.inst_var = here->inst_var;
cm_data.callback = &(here->callback);
here->callback(&cm_data, MIF_CB_DESTROY);
}
/*******************************/
/* Free the instance structure */