summaryrefslogtreecommitdiffstats
path: root/Process.c
diff options
context:
space:
mode:
authorzed_0xff <zed.0xff@gmail.com>2014-01-21 11:35:53 +0300
committerzed_0xff <zed.0xff@gmail.com>2014-01-21 11:35:53 +0300
commit7afda7f5a1309fbb93ce84423b78a18165fd74be (patch)
treed9dc2a4d3b3e952035ee4f22fa9e5755f789d2f7 /Process.c
parent76a715ee8c8c8ace5a341d81ca39dd1747886187 (diff)
fix column shift on wrong megabytes format
see http://0xff.me/htop_bug.png
Diffstat (limited to 'Process.c')
-rw-r--r--Process.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Process.c b/Process.c
index 608ad4cc..695e1447 100644
--- a/Process.c
+++ b/Process.c
@@ -294,11 +294,14 @@ void Process_getMaxPid() {
#define ONE_M (ONE_K * ONE_K)
#define ONE_G (ONE_M * ONE_K)
+#define ONE_DECIMAL_K 1000
+#define ONE_DECIMAL_M (ONE_DECIMAL_K * ONE_DECIMAL_K)
+
static void Process_humanNumber(Process* this, RichString* str, unsigned long number) {
char buffer[11];
int len;
- if(number >= (10 * ONE_M)) {
- if(number >= (100 * ONE_M)) {
+ if(number >= (10 * ONE_DECIMAL_M)) {
+ if(number >= (100 * ONE_DECIMAL_M)) {
len = snprintf(buffer, 10, "%4ldG ", number / ONE_M);
RichString_appendn(str, CRT_colors[LARGE_NUMBER], buffer, len);
} else {

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