From ad966e2fe87824d6e12e91caf88c6975ffe99f88 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sat, 14 Feb 2026 12:34:20 +0100 Subject: [PATCH] Add function to delete the result hash table. Not yet used. --- src/frontend/inpdeg.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/frontend/inpdeg.c b/src/frontend/inpdeg.c index 19ba677a0..a41ae5213 100644 --- a/src/frontend/inpdeg.c +++ b/src/frontend/inpdeg.c @@ -16,6 +16,7 @@ License: Modified BSD #include "inpcom.h" int prepare_degsim(struct card* deck); +int clear_degsim(void); static int add_degmodel(struct card* deck, double* result); /* maximum number of model parameters */ @@ -338,6 +339,8 @@ int prepare_degsim(struct card* deck) { result = (double*)nghash_find(degdatahash, insttoken); if (result) { fprintf(stdout, "Instance %s, Result: %e, %e, %e\n", insttoken, result[0], result[1], result[2]); + /* this will add the necessary devices to + the netlist according to the deg model */ add_degmodel(prevcard, result); } else @@ -353,9 +356,21 @@ int prepare_degsim(struct card* deck) { return 0; } +/* user defined delete function */ +static void +del_data(void* rdata) +{ + double* data = (double*)rdata; + if (data) { + tfree(data); + } +} + /* clear memory */ int clear_degsim (void){ - /* delete the hashtables */ + /* delete the result hashtable */ + if(degdatahash) + nghash_free(degdatahash, del_data, NULL); return 0; }