aboutsummaryrefslogtreecommitdiffstats
path: root/MemoryMeter.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 /MemoryMeter.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 'MemoryMeter.c')
-rw-r--r--MemoryMeter.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/MemoryMeter.c b/MemoryMeter.c
index 43029ff..5efa5b7 100644
--- a/MemoryMeter.c
+++ b/MemoryMeter.c
@@ -35,23 +35,15 @@ struct MemoryMeter_ {
MemoryMeter* MemoryMeter_new(ProcessList* pl) {
MemoryMeter* this = malloc(sizeof(MemoryMeter));
Meter_init((Meter*)this, String_copy("Memory"), String_copy("Mem"), 3);
- ((Meter*)this)->attributes[0] = &(CRT_colors[MEMORY_USED]);
- ((Meter*)this)->attributes[1] = &(CRT_colors[MEMORY_BUFFERS]);
- ((Meter*)this)->attributes[2] = &(CRT_colors[MEMORY_CACHE]);
+ ((Meter*)this)->attributes[0] = MEMORY_USED;
+ ((Meter*)this)->attributes[1] = MEMORY_BUFFERS;
+ ((Meter*)this)->attributes[2] = MEMORY_CACHE;
((Meter*)this)->setValues = MemoryMeter_setValues;
((Object*)this)->display = MemoryMeter_display;
this->pl = pl;
Meter_setMode((Meter*)this, BAR);
- if (this->pl->totalMem > 1000000) {
- this->wideFormat = "%7ldk ";
- this->wideLimit = 22 + 9 * 4;
- } else if (this->pl->totalMem > 100000) {
- this->wideFormat = "%6ldk ";
- this->wideLimit = 22 + 8 * 4;
- } else {
- this->wideFormat = "%5ldk ";
- this->wideLimit = 22 + 7 * 4;
- }
+ this->wideFormat = "%6ldk ";
+ this->wideLimit = 22 + 8 * 4;
return this;
}
@@ -88,11 +80,11 @@ void MemoryMeter_display(Object* cast, RichString* out) {
RichString_append(out, CRT_colors[METER_VALUE], buffer);
sprintf(buffer, format, usedMem);
RichString_append(out, CRT_colors[METER_TEXT], "used:");
- RichString_append(out, *(meter->attributes[0]), buffer);
+ RichString_append(out, CRT_colors[MEMORY_USED], buffer);
sprintf(buffer, format, buffersMem);
RichString_append(out, CRT_colors[METER_TEXT], "buffers:");
- RichString_append(out, *(meter->attributes[1]), buffer);
+ RichString_append(out, CRT_colors[MEMORY_BUFFERS], buffer);
sprintf(buffer, format, cachedMem);
RichString_append(out, CRT_colors[METER_TEXT], "cache:");
- RichString_append(out, *(meter->attributes[2]), buffer);
+ RichString_append(out, CRT_colors[MEMORY_CACHE], buffer);
}

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