Use glib for allocations in all plugins

Continuation of 83032b1aa
This commit is contained in:
TingPing
2014-12-28 06:08:20 -05:00
parent 83032b1aa3
commit 3f855f07f5
26 changed files with 118 additions and 257 deletions

View File

@@ -22,6 +22,7 @@
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include <glib.h>
#include "xsys.h"
float percentage(unsigned long long *free, unsigned long long *total)
@@ -37,13 +38,13 @@ char *pretty_freespace(const char *desc, unsigned long long *free_k, unsigned lo
double free_space, total_space;
free_space = *free_k;
total_space = *total_k;
result = malloc(bsize * sizeof(char));
result = g_new(char, bsize);
if (total_space == 0)
{
snprintf(result, bsize, "%s: none", desc);
return result;
}
quantity = quantities;
quantity = quantities;
while (total_space > 1023 && *(quantity + 1))
{
quantity++;