From df1914f4295fdd1e566c10cebd5a51c7bab0361a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Wed, 8 Dec 2021 14:20:54 +0100 Subject: [PATCH] Add ScreenSettings_delete helper --- Settings.c | 10 +++++++--- Settings.h | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Settings.c b/Settings.c index 5cc09502..4b76d612 100644 --- a/Settings.c +++ b/Settings.c @@ -75,9 +75,7 @@ void Settings_delete(Settings* this) { free(this->hColumns); if (this->screens) { for (unsigned int i = 0; this->screens[i]; i++) { - free(this->screens[i]->name); - free(this->screens[i]->fields); - free(this->screens[i]); + ScreenSettings_delete(this->screens[i]); } free(this->screens); } @@ -285,6 +283,12 @@ ScreenSettings* Settings_newScreen(Settings* this, const char* name, const char* return ss; } +void ScreenSettings_delete(ScreenSettings* this) { + free(this->name); + free(this->fields); + free(this); +} + static ScreenSettings* Settings_defaultScreens(Settings* this) { if (this->nScreens) return this->screens[0]; diff --git a/Settings.h b/Settings.h index 2ca8034d..314b516b 100644 --- a/Settings.h +++ b/Settings.h @@ -118,6 +118,8 @@ Settings* Settings_new(unsigned int initialCpuCount, Hashtable* dynamicColumns); ScreenSettings* Settings_newScreen(Settings* this, const char* name, const char* line); +void ScreenSettings_delete(ScreenSettings* this); + void ScreenSettings_invertSortOrder(ScreenSettings* this); void ScreenSettings_setSortKey(ScreenSettings* this, ProcessField sortKey);