diff options
author | Nathan Scott <natoscott@users.noreply.github.com> | 2022-05-01 16:21:13 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-01 16:21:13 +1000 |
commit | 10b541b5e4ccd59dc4a6301b58d97a37a90b4228 (patch) | |
tree | 66968fd1948e59f21347b2f1cd7a8567e73acf8a | |
parent | cde72dd0b0bcc971ffa0a343e4a5177eed1b8765 (diff) |
Update Settings_newScreen with single-line sortKey checking.
Co-authored-by: BenBE <BenBE@geshi.org>
-rw-r--r-- | Settings.c | 6 |
1 files changed, 1 insertions, 5 deletions
@@ -271,11 +271,7 @@ static void ScreenSettings_readFields(ScreenSettings* ss, Hashtable* columns, co ScreenSettings* Settings_newScreen(Settings* this, const ScreenDefaults* defaults) { int sortKey = defaults->sortKey ? toFieldIndex(this->dynamicColumns, defaults->sortKey) : PID; - int sortDesc; - if (sortKey >= 0 && sortKey < LAST_PROCESSFIELD) - sortDesc = Process_fields[sortKey].defaultSortDesc; - else - sortDesc = 1; + int sortDesc = (sortKey >= 0 && sortKey < LAST_PROCESSFIELD) ? Process_fields[sortKey].defaultSortDesc : 1; ScreenSettings* ss = xMalloc(sizeof(ScreenSettings)); *ss = (ScreenSettings) { |