1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-17 10:35:10 +00:00

some fixes

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@87 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Brenden Matthews 2005-08-08 23:12:43 +00:00
parent 0b8d982116
commit c1d0dc5ec0
5 changed files with 17 additions and 14 deletions

View File

@ -53,7 +53,7 @@
<ccompiler>kdevgccoptions</ccompiler> <ccompiler>kdevgccoptions</ccompiler>
<cxxcompiler>kdevgppoptions</cxxcompiler> <cxxcompiler>kdevgppoptions</cxxcompiler>
<f77compiler>kdevpgf77options</f77compiler> <f77compiler>kdevpgf77options</f77compiler>
<cflags>-O2 -Wall -fexceptions -fomit-frame-pointer -fshort-enums -g3</cflags> <cflags>-O2 -Wall -fexceptions -fomit-frame-pointer -fshort-enums -g3 -CB</cflags>
<envvars/> <envvars/>
<topsourcedir></topsourcedir> <topsourcedir></topsourcedir>
<cppflags></cppflags> <cppflags></cppflags>
@ -68,18 +68,18 @@
<envvars/> <envvars/>
<configargs>--enable-debug=full --prefix=/usr --enable-mpd --enable-xft --enable-seti --enable-double-buffer --enable-own-window --enable-metar --enable-mldonkey --disable-x11</configargs> <configargs>--enable-debug=full --prefix=/usr --enable-mpd --enable-xft --enable-seti --enable-double-buffer --enable-own-window --enable-metar --enable-mldonkey --disable-x11</configargs>
<builddir>debug-no-x</builddir> <builddir>debug-no-x</builddir>
<topsourcedir></topsourcedir> <topsourcedir/>
<cppflags></cppflags> <cppflags/>
<ldflags></ldflags> <ldflags/>
<ccompiler>kdevgccoptions</ccompiler> <ccompiler>kdevgccoptions</ccompiler>
<cxxcompiler>kdevgppoptions</cxxcompiler> <cxxcompiler>kdevgppoptions</cxxcompiler>
<f77compiler>kdevpgf77options</f77compiler> <f77compiler>kdevpgf77options</f77compiler>
<ccompilerbinary></ccompilerbinary> <ccompilerbinary/>
<cxxcompilerbinary></cxxcompilerbinary> <cxxcompilerbinary/>
<f77compilerbinary></f77compilerbinary> <f77compilerbinary/>
<cflags>-O2 -Wall -fexceptions -fomit-frame-pointer -fshort-enums -g3</cflags> <cflags>-O2 -Wall -fexceptions -fomit-frame-pointer -fshort-enums -g3</cflags>
<cxxflags></cxxflags> <cxxflags/>
<f77flags></f77flags> <f77flags/>
</debug-no-x> </debug-no-x>
</configurations> </configurations>
<make> <make>

View File

@ -33,7 +33,7 @@ FILE *open_file(const char *file, int *reported)
FILE *fp = fopen(file, "r"); FILE *fp = fopen(file, "r");
if (!fp) { if (!fp) {
if (!reported || *reported == 0) { if (!reported || *reported == 0) {
ERR("can't open %s: %s", file, strerror(errno)); CRIT_ERR("can't open %s: %s", file, strerror(errno));
if (reported) if (reported)
*reported = 1; *reported = 1;
} }

View File

@ -9,6 +9,7 @@
#ifndef _conky_h_ #ifndef _conky_h_
#define _conky_h_ #define _conky_h_
#undef MALLOC_CHECK_
//#include <mcheck.h> //#include <mcheck.h>
#include "config.h" #include "config.h"

View File

@ -279,7 +279,7 @@ inline void update_wifi_stats()
net_wireless_fp = open_file("/proc/net/wireless", &rep); net_wireless_fp = open_file("/proc/net/wireless", &rep);
else else
fseek(net_wireless_fp, 0, SEEK_SET); fseek(net_wireless_fp, 0, SEEK_SET);
if (!net_wireless_fp) if (net_wireless_fp == NULL)
return; return;
fgets(buf, 255, net_wireless_fp); /* garbage */ fgets(buf, 255, net_wireless_fp); /* garbage */

8
top.c
View File

@ -371,7 +371,7 @@ inline static void calc_cpu_each(int total)
/* /*
* Result is stored in decreasing order in best[0-9]. * Result is stored in decreasing order in best[0-9].
*/ */
#define MAX_TOP_SIZE 400 /* this is plenty big */
static struct process **sorttmp; static struct process **sorttmp;
static size_t sorttmp_size = 10; static size_t sorttmp_size = 10;
@ -408,7 +408,7 @@ inline void process_find_top(struct process **cpu, struct process **mem)
if (i < sorttmp_size && pr->counted) { if (i < sorttmp_size && pr->counted) {
sorttmp[i] = pr; sorttmp[i] = pr;
i++; i++;
} else if (i == sorttmp_size && pr->counted) { } else if (i == sorttmp_size && pr->counted && sorttmp_size < MAX_TOP_SIZE) {
sorttmp_size++; sorttmp_size++;
sorttmp = sorttmp =
realloc(sorttmp, realloc(sorttmp,
@ -420,6 +420,7 @@ inline void process_find_top(struct process **cpu, struct process **mem)
pr = pr->next; pr = pr->next;
} }
if (i + 1 < sorttmp_size) { if (i + 1 < sorttmp_size) {
sorttmp_size--;
sorttmp = sorttmp =
realloc(sorttmp, realloc(sorttmp,
sizeof(struct process) * sorttmp_size); sizeof(struct process) * sorttmp_size);
@ -461,7 +462,7 @@ inline void process_find_top(struct process **cpu, struct process **mem)
if (i < sorttmp_size && pr->counted) { if (i < sorttmp_size && pr->counted) {
sorttmp[i] = pr; sorttmp[i] = pr;
i++; i++;
} else if (i == sorttmp_size && pr->counted) { } else if (i == sorttmp_size && pr->counted && sorttmp_size < MAX_TOP_SIZE) {
sorttmp_size++; sorttmp_size++;
sorttmp = sorttmp =
realloc(sorttmp, realloc(sorttmp,
@ -473,6 +474,7 @@ inline void process_find_top(struct process **cpu, struct process **mem)
pr = pr->next; pr = pr->next;
} }
if (i + 1 < sorttmp_size) { if (i + 1 < sorttmp_size) {
sorttmp_size--;
sorttmp = sorttmp =
realloc(sorttmp, realloc(sorttmp,
sizeof(struct process) * sorttmp_size); sizeof(struct process) * sorttmp_size);