aboutsummaryrefslogtreecommitdiffstats
path: root/LoadMeter.c
diff options
context:
space:
mode:
authorBartosz Fenski <fenio@debian.org>2005-12-29 13:22:07 +0100
committerDaniel Lange <DLange@git.local>2016-04-11 13:00:19 +0200
commit73c04eaf1f6f01d0f8c15e8b70f68eda70bebc37 (patch)
tree054866c7de4fa4511c30658857f820724d686ec5 /LoadMeter.c
parent55a3aa9e6a59c1bf0248869d9f08e31ec4057c61 (diff)
parent266ab52b3a741a58fb17c48b0f7939d7c5d266de (diff)
downloaddebian_htop-73c04eaf1f6f01d0f8c15e8b70f68eda70bebc37.tar.gz
debian_htop-73c04eaf1f6f01d0f8c15e8b70f68eda70bebc37.tar.bz2
debian_htop-73c04eaf1f6f01d0f8c15e8b70f68eda70bebc37.zip
Imported Debian patch 0.6-1debian/0.6-1
Diffstat (limited to 'LoadMeter.c')
-rw-r--r--LoadMeter.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/LoadMeter.c b/LoadMeter.c
index c2b2af7..b93f305 100644
--- a/LoadMeter.c
+++ b/LoadMeter.c
@@ -26,7 +26,7 @@ struct LoadMeter_ {
LoadMeter* LoadMeter_new() {
LoadMeter* this = malloc(sizeof(LoadMeter));
Meter_init((Meter*)this, String_copy("Load"), String_copy("Load: "), 1);
- ((Meter*)this)->attributes[0] = &(CRT_colors[LOAD]);
+ ((Meter*)this)->attributes[0] = LOAD;
((Meter*)this)->setValues = LoadMeter_setValues;
((Object*)this)->display = LoadMeter_display;
Meter_setMode((Meter*)this, GRAPH);
@@ -38,8 +38,10 @@ LoadMeter* LoadMeter_new() {
void LoadMeter_scan(double* one, double* five, double* fifteen) {
int activeProcs, totalProcs, lastProc;
FILE *fd = fopen(PROCDIR "/loadavg", "r");
- fscanf(fd, "%lf %lf %lf %d/%d %d", one, five, fifteen,
+ int read = fscanf(fd, "%lf %lf %lf %d/%d %d", one, five, fifteen,
&activeProcs, &totalProcs, &lastProc);
+ (void) read;
+ assert(read == 6);
fclose(fd);
}
@@ -53,10 +55,9 @@ void LoadMeter_setValues(Meter* cast) {
}
void LoadMeter_display(Object* cast, RichString* out) {
- Meter* super = (Meter*)cast;
LoadMeter* this = (LoadMeter*)cast;
char buffer[20];
RichString_prune(out);
sprintf(buffer, "%.2f ", ((Meter*)this)->values[0]);
- RichString_append(out, *(super->attributes[0]), buffer);
+ RichString_append(out, CRT_colors[LOAD], buffer);
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy