summaryrefslogtreecommitdiffstats
path: root/Macros.h
Commit message (Collapse)AuthorAgeFilesLines
* Clarify isNonnegative() behavior in commentsExplorer092024-01-081-4/+5
| | | | | Also fix some comments of isNaN() and isPositive() functions. No code changes.
* Update includes based on IWYUBenny Baumann2023-12-261-0/+2
|
* Add configure check for nonnull attributeExplorer092023-10-111-2/+12
| | | | | | | The main reason I do this is to document the minimum compiler version (GCC 3.3) for the attribute. But it may work with other compilers, too. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
* Merge branch 'style-header-consistency' of https://github.com/BenBE/htop ↵Nathan Scott2023-10-101-0/+6
|\ | | | | | | into BenBE-style-header-consistency
| * Add missing copyright/file headersBenny Baumann2023-05-251-0/+6
| |
* | Replace isnan() with better comparisons (isgreater(), etc.)Explorer092023-08-181-0/+20
|/ | | | | | | | | | | | | | | | | | The standard isnan() function is defined to never throw FP exceptions even when the argument is a "signaling" NaN. This makes isnan() more expensive than (x != x) expression unless the compiler flag '-fno-signaling-nans' is given. Introduce functions isNaN(), isNonnegative(), isPositive(), sumPositiveValues() and compareRealNumbers(), and replace isnan() in htop's codebase with the new functions. These functions utilize isgreater() and isgreaterequal() comparisons, which do not throw FP exceptions on "quiet" NaNs, which htop uses extensively. With isnan() removed, there is no need to suppress the warning '-Wno-c11-extensions' in FreeBSD. Remove the code from 'configure.ac'. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
* Annotate functions with access attributeChristian Göttsche2023-02-181-0/+21
| | | | Supported by GCC since version 10.
* Check for alloc_size attribute in configure.acBenny Baumann2021-07-061-4/+12
|
* Replaces WRAP_SUBTRACT with saturatingSub inline function to reduce code ↵fraggerfox2021-06-261-1/+1
| | | | duplication.
* Refactor saturatingSub() to be part of Macros.hfraggerfox2021-06-261-0/+5
|
* Rework TTY columnChristian Göttsche2021-04-141-6/+10
| | | | | | | | | | * Rename internal identifier from TTY_NR to just TTY * Unify column header on platforms * Use devname(3) on BSD derivate to show the actual terminal, simplifies current FreeBSD implementation. * Use 'unsigned long int' as id type, to fit dev_t on Linux. Only on Solaris the terminal path is not yet resolved.
* Use `#if defined()` syntax when `#elif defined()` is presentBenny Baumann2021-03-211-1/+1
| | | | | | | This prefers the `#if defined()` syntax over the `#ifdef` variant whenever there's also a `#elif defined()` clause, thus making the multiple branching structure more obvious and the overall use more consistent.
* Add compiler hints on memory allocating utility functionsChristian Göttsche2021-01-111-0/+6
|
* Introduce spaceship comparison for ProcessesChristian Göttsche2020-11-151-4/+12
| | | | | | | | | | | | | | | If currently two unsigned values are compared via `a - b`, in the case b is actually bigger than a, the result will not be an negative number (as -1 is expected) but a huge positive number as the subtraction is an unsigned subtraction. Avoid over-/underflow affected operations; use comparisons. Modern compilers will generate sane code, like: xor eax, eax cmp rdi, rsi seta al sbb eax, 0 ret
* Drop tabs in source indentionsChristian Göttsche2020-10-201-3/+3
|
* Allow low and high value of CLAMP to be equalChristian Göttsche2020-10-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 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]
* Make all required includes explicitBenny Baumann2020-10-181-0/+2
| | | | Information as seen by IWYU 0.12 + clang 9 on Linux
* Enclose CLAMP macro arguments in parenthesesChristian Göttsche2020-10-061-1/+1
|
* Enable -Wcast-qual compiler warningChristian Göttsche2020-10-061-0/+16
|
* Assert that low value is lower than the high value in CLAMPChristian Göttsche2020-10-051-1/+1
|
* Introduce ARRAYSIZEChristian Göttsche2020-10-031-0/+4
|
* Refactor __attribute__ usageChristian Göttsche2020-09-181-0/+16
| | | | Use internal macros for compatibility with non GNUC compilers.
* Consolidate repeated macro definitions into one headerNathan Scott2020-09-091-0/+16
The MIN, MAX, CLAMP, MINIMUM, and MAXIMUM macros appear throughout the codebase with many re-definitions. Make a single copy of each in a common header file, and use the BSD variants of MINIMUM/MAXIMUM due to conflicts in the system <sys/param.h> headers.

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