summaryrefslogtreecommitdiffstats
path: root/Macros.h
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-10-18 17:48:24 +0200
committercgzones <cgzones@googlemail.com>2020-10-19 14:13:58 +0200
commit0db398d4c3472071b2814505242450cd8f831501 (patch)
treeefc3a6be26912a628f5340d05a428d1e16b73a34 /Macros.h
parent0f5262917fab34b44b43f63946fdf6bb0621875a (diff)
Allow low and high value of CLAMP to be equal
Can for example occur in RichString_setAttrn(), when pausing and resuming process tracing: htop: RichString.c:56: void RichString_setAttrn(RichString *, int, int, int): Assertion `(0) < (this->chlen - 1)' failed. ./htop(backtrace+0x5b)[0x45d9eb] ./htop(CRT_handleSIGSEGV+0x189)[0x4ebab9] /lib/x86_64-linux-gnu/libpthread.so.0(+0x14140)[0x7fd249d35140] /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x141)[0x7fd249b6ac41] /lib/x86_64-linux-gnu/libc.so.6(abort+0x123)[0x7fd249b54537] /lib/x86_64-linux-gnu/libc.so.6(+0x2540f)[0x7fd249b5440f] /lib/x86_64-linux-gnu/libc.so.6(+0x345c2)[0x7fd249b635c2] ./htop(RichString_setAttrn+0x234)[0x526de4] ./htop(RichString_setAttr+0x50)[0x5275c0] ./htop(Panel_draw+0x17b6)[0x514c26] ./htop(InfoScreen_run+0x305)[0x4fe7a5] ./htop[0x4d59d8] ./htop[0x5029cf] ./htop(ScreenManager_run+0x69f)[0x52a82f] ./htop(main+0x704)[0x4f8774] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xea)[0x7fd249b55cca] ./htop(_start+0x2a)[0x4268ea]
Diffstat (limited to 'Macros.h')
-rw-r--r--Macros.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/Macros.h b/Macros.h
index e42cbe53..2f92acb1 100644
--- a/Macros.h
+++ b/Macros.h
@@ -12,7 +12,7 @@
#endif
#ifndef CLAMP
-#define CLAMP(x, low, high) (assert((low) < (high)), ((x) > (high)) ? (high) : MAXIMUM(x, low))
+#define CLAMP(x, low, high) (assert((low) <= (high)), ((x) > (high)) ? (high) : MAXIMUM(x, low))
#endif
#ifndef ARRAYSIZE

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