refactored internal state keeping

This commit is contained in:
Linus Dierheimer
2021-02-27 18:30:05 +01:00
parent b44ab16dd1
commit 1cda1eb653
28 changed files with 304 additions and 227 deletions
+3 -3
View File
@@ -1,11 +1,11 @@
#include "fastfetch.h"
// Impl by: https://github.com/sam-barr/paleofetch/blob/b7c58a52c0de39b53c9b5f417889a5886d324bfa/paleofetch.c#L544
void ffPrintMemory(FFstate* state)
void ffPrintMemory(FFinstance* instance)
{
FILE* meminfo = fopen("/proc/meminfo", "r");
if(meminfo == NULL) {
ffPrintError(state, "Memory", "fopen(\"/proc/meminfo\", \"r\") == NULL");
ffPrintError(instance, "Memory", "fopen(\"/proc/meminfo\", \"r\") == NULL");
return;
}
@@ -30,6 +30,6 @@ void ffPrintMemory(FFstate* state)
uint32_t total_mem = total / 1024;
uint8_t percentage = (uint8_t) ((used_mem / (double) total_mem) * 100);
ffPrintLogoAndKey(state, "Memory");
ffPrintLogoAndKey(instance, "Memory");
printf("%uMiB / %uMiB (%u%%)\n", used_mem, total_mem, percentage);
}