From f80394a20254938142011855f2954b3f63fe5909 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Tue, 15 Sep 2020 08:00:00 +0200 Subject: New upstream version 3.0.2 --- Settings.c | 68 -------------------------------------------------------------- 1 file changed, 68 deletions(-) (limited to 'Settings.c') diff --git a/Settings.c b/Settings.c index 81d547b..d6ef53b 100644 --- a/Settings.c +++ b/Settings.c @@ -17,64 +17,6 @@ in the source distribution for its full text. #include #include -#define DEFAULT_DELAY 15 - -/*{ -#include "Process.h" -#include - -typedef struct { - int len; - char** names; - int* modes; -} MeterColumnSettings; - -typedef struct Settings_ { - char* filename; - - MeterColumnSettings columns[2]; - - ProcessField* fields; - int flags; - int colorScheme; - int delay; - - int cpuCount; - int direction; - ProcessField sortKey; - - bool countCPUsFromZero; - bool detailedCPUTime; - bool showCPUUsage; - bool showCPUFrequency; - bool treeView; - bool showProgramPath; - bool hideThreads; - bool shadowOtherUsers; - bool showThreadNames; - bool hideKernelThreads; - bool hideUserlandThreads; - bool highlightBaseName; - bool highlightMegabytes; - bool highlightThreads; - bool updateProcessNames; - bool accountGuestInCPUMeter; - bool headerMargin; - bool enableMouse; - bool vimMode; - #ifdef HAVE_LIBHWLOC - bool topologyAffinity; - #endif - - bool changed; -} Settings; - -#ifndef Settings_cpuId -#define Settings_cpuId(settings, cpu) ((settings)->countCPUsFromZero ? (cpu) : (cpu)+1) -#endif - -}*/ - void Settings_delete(Settings* this) { free(this->filename); free(this->fields); @@ -121,7 +63,6 @@ static void Settings_defaultMeters(Settings* this) { this->columns[i].modes = xCalloc(sizes[i], sizeof(int)); this->columns[i].len = sizes[i]; } - int r = 0; if (this->cpuCount > 8) { this->columns[0].names[0] = xStrdup("LeftCPUs2"); @@ -141,7 +82,6 @@ static void Settings_defaultMeters(Settings* this) { this->columns[0].modes[1] = BAR_METERMODE; this->columns[0].names[2] = xStrdup("Swap"); this->columns[0].modes[2] = BAR_METERMODE; - this->columns[1].names[r] = xStrdup("Tasks"); this->columns[1].modes[r++] = TEXT_METERMODE; this->columns[1].names[r] = xStrdup("LoadAverage"); @@ -172,13 +112,11 @@ static void readFields(ProcessField* fields, int* flags, const char* line) { static bool Settings_read(Settings* this, const char* fileName) { FILE* fd; - CRT_dropPrivileges(); fd = fopen(fileName, "r"); CRT_restorePrivileges(); if (!fd) return false; - bool didReadMeters = false; bool didReadFields = false; for (;;) { @@ -257,8 +195,6 @@ static bool Settings_read(Settings* this, const char* fileName) { } else if (String_eq(option[0], "right_meter_modes")) { Settings_readMeterModes(this, option[1], 1); didReadMeters = true; - } else if (String_eq(option[0], "vim_mode")) { - this->vimMode = atoi(option[1]); #ifdef HAVE_LIBHWLOC } else if (String_eq(option[0], "topology_affinity")) { this->topologyAffinity = !!atoi(option[1]); @@ -342,7 +278,6 @@ bool Settings_write(Settings* this) { fprintf(fd, "left_meter_modes="); writeMeterModes(this, fd, 0); fprintf(fd, "right_meters="); writeMeters(this, fd, 1); fprintf(fd, "right_meter_modes="); writeMeterModes(this, fd, 1); - fprintf(fd, "vim_mode=%d\n", (int) this->vimMode); #ifdef HAVE_LIBHWLOC fprintf(fd, "topology_affinity=%d\n", (int) this->topologyAffinity); #endif @@ -351,7 +286,6 @@ bool Settings_write(Settings* this) { } Settings* Settings_new(int cpuCount) { - Settings* this = xCalloc(1, sizeof(Settings)); this->sortKey = PERCENT_CPU; @@ -375,7 +309,6 @@ Settings* Settings_new(int cpuCount) { #ifdef HAVE_LIBHWLOC this->topologyAffinity = false; #endif - this->fields = xCalloc(Platform_numberOfFields+1, sizeof(ProcessField)); // TODO: turn 'fields' into a Vector, // (and ProcessFields into proper objects). @@ -406,7 +339,6 @@ Settings* Settings_new(int cpuCount) { htopDir = String_cat(home, "/.config/htop"); } legacyDotfile = String_cat(home, "/.htoprc"); - CRT_dropPrivileges(); (void) mkdir(configDir, 0700); (void) mkdir(htopDir, 0700); -- cgit v1.2.3