Skip to content

Commit

Permalink
I'm a fucking idiot
Browse files Browse the repository at this point in the history
  • Loading branch information
alba4k committed Jan 2, 2025
1 parent 7b3c1ef commit f9d5ff8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/config/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ void parse_config(const char *file, struct Module *modules, void **ascii_ptr, bo
"pwd_path",
"kernel_type",
"col_background",
"bat_status"
"bat_status",
"swap_perc"
};

Expand Down
3 changes: 2 additions & 1 deletion src/info/packages.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
// get the number of installed packages
int packages(char *dest) {
dest[0] = 0;
char buf[256] = "", str[128] = "", path[256] = "";
char buf[256] = "", str[128] = "";
DIR *dir;
struct dirent *entry;
unsigned count = 0;
Expand All @@ -36,6 +36,7 @@ int packages(char *dest) {
#ifdef __linux__ // package managers that won't run on macOS
FILE *fp;
char *prefix = getenv("PREFIX");
char path[256];

path[0] = 0;
if(prefix)
Expand Down
2 changes: 1 addition & 1 deletion src/info/swap.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ int swap(char *dest) {
unsigned long usedswap = totalswap - freeswap;

snprintf(dest, 256, "%lu MiB / %lu MiB", usedswap/1024, totalswap/1024);
#endif

if(_swap_perc) {
const size_t len = 256-strlen(dest);
Expand All @@ -37,6 +36,7 @@ int swap(char *dest) {
snprintf(perc, len, " (%lu%%)", (unsigned long)((usedswap * 100) / totalswap));
strcat(dest, perc);
}
#endif

return 0;
}

0 comments on commit f9d5ff8

Please sign in to comment.