summaryrefslogtreecommitdiffstats
path: root/RichString.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix GCC build warning in NetBSD 10mainExplorer0947 hours1-1/+4
| | | | | | | | | | | | | The warning message is "array subscript has type 'char' [-Wchar-subscripts]" Fix this by casting to 'unsigned char' before passing any character to a `<ctype.h>` function. Also add an assertion to RichString_writeFromAscii() to ensure the characters in the string are all in ASCII range. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
* Properly handle RichString_extendLen when an external buffer already existsBenny Baumann2024-04-071-4/+12
|
* Handle invalid multi-byte strings gracefullyChristian Göttsche2024-01-201-4/+37
| | | | | | | In case the string to be printed contains invalid wide characters, continue to translate after the invalid character instead of aborting. Closes: #1373
* Add includes for config.h as per the discussion in PR #1337Daniel Lange2023-12-261-0/+2
| | | | | | Many thanks to @Explorer09 Kang-Che Sung (宋岡哲). Also add a #error stanza to XUtils.h in case somebody forgets the beautiful mess GNU forces on us.
* Use Unicode replacement characterChristian Göttsche2022-12-261-3/+3
| | | | | In unicode mode replace non-printable characters with the Unciode replacement character U+FFFD ("�").
* Update license headers to explicitly say GPLv2+Daniel Lange2021-09-221-1/+1
|
* IWYU updateChristian Göttsche2021-08-251-1/+0
|
* cleaned up includes with iwyumayurdahibhate2021-05-101-0/+1
|
* RichString: do not unnecessarily clean whole bufferChristian Göttsche2021-03-171-4/+4
| | | | | | | The local stack buffer does not need to be cleaned to zeros when - just initialized, cause the length is set to 0 and the first character is set to '\0', so all printing functions will safely stop - no further used, i.e. the variable goes out of scope
* RichString: implement safe rewindChristian Göttsche2021-01-151-0/+4
| | | | | The current rewind logic causes issues when rewinding over the short string optimization boundary.
* RichString: refactor writing limited amount of columnsChristian Göttsche2021-01-151-1/+37
| | | | Closes: #468
* RichString_appendChr: add parameter to set attributesChristian Göttsche2021-01-131-9/+18
| | | | | | | Allows to set attributes when padding process fields in non-wide ncurses mode. Closes: #475
* Mark several non-modified pointer variables constChristian Göttsche2021-01-111-5/+5
|
* Linux: use correct column alignment for wide fieldsChristian Göttsche2021-01-111-1/+1
| | | | | | | This affects: - PROC_COMM, PROC_EXE and CWD on Linux - JAIL on FreeBSD and DragonFlyBSD - ZONE on Solaris
* RichString_setAttrn: refactor to take a length instead of a stop indexChristian Göttsche2021-01-101-13/+9
| | | | Fixes: #459
* RichString: return number of written characters on write/append functionsChristian Göttsche2020-12-231-19/+25
|
* Split RichString_(append|appendn|write) into wide and asciiChristian Göttsche2020-12-081-8/+33
| | | | | | | | RichString_writeFrom takes a top spot during performance analysis due to the calls to mbstowcs() and iswprint(). Most of the time we know in advance that we are only going to print regular ASCII characters.
* RichString: avoid signed integer misuseChristian Göttsche2020-12-051-1/+1
|
* Fully support non-ascii characters in Meter-BarChristian Göttsche2020-11-251-0/+9
| | | | | | | | | | Currently the code does not handle multi-byte characters, so length- computations take the raw count of C characters and not the to displayed size into account. An example is the degree sign for temperatures. Closes: #329
* Embracing branchesBenny Baumann2020-11-021-1/+3
|
* Spacing around operatorsBenny Baumann2020-11-021-1/+1
|
* Implement RichString_setLen as functionChristian Göttsche2020-10-281-1/+8
| | | | Make it more readable and fix unenclosed macro arguments
* IWYU updateChristian Göttsche2020-10-201-1/+0
| | | | | | | | | | | - Add Settings forward declaration in Process.h - Add assert.h include in XUitls.c - Add conditional stdbool.h include in Object.h - Drop unneeded stddef.h include in Richstring.c - Drop unneeded unistd.h include in Process.h - Drop unneeded string.h include in linux/Platform.c - Use String_eq to avoid string.h include in Action.c - Improve script to run custom iwyu version
* Make all required includes explicitBenny Baumann2020-10-181-2/+4
| | | | Information as seen by IWYU 0.12 + clang 9 on Linux
* Combine XAlloc.[ch] into XUtils.[ch]Benny Baumann2020-10-171-1/+2
|
* Update License consistently to GPLv2 as per COPYING fileDaniel Lange2020-10-051-1/+1
|
* Avoid checking of undefined macrosChristian Göttsche2020-09-181-2/+2
| | | | | These feature macros are either define or not defined at all at the configure step.
* Clean up some code duplication in the header filesHugo Musso Gualandi2020-09-121-2/+0
| | | | | | | | | | | | | PR htop-dev/htop#70 got rid of the infrastructure for generating header files, but it left behind some code duplication. Some of cases are things that belong in the header file and don't need to be repeated in the C file. Other cases are things that belong in the C file and don't need to be in the header file. In this commit I tried to fix all of these that I could find. When given a choice I preferred keeping things out of the header file, unless they were being used by someone else.
* Consolidate repeated macro definitions into one headerNathan Scott2020-09-091-5/+1
| | | | | | | | 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.
* Axe automated header generation.Zev Weiss2020-09-031-49/+0
| | | | | | | | | | | | | | Reasoning: - implementation was unsound -- broke down when I added a fairly basic macro definition expanding to a struct initializer in a *.c file. - made it way too easy (e.g. via otherwise totally innocuous git commands) to end up with timestamps such that it always ran MakeHeader.py but never used its output, leading to overbuild noise when running what should be a null 'make'. - but mostly: it's just an awkward way of dealing with C code.
* Clean up existing whitespaceDaniel Flanagan2019-10-311-1/+1
|
* Protect against overflows in RichString_setAttrnHisham Muhammad2018-02-261-0/+6
|
* Check for failure in allocations.Hisham2016-02-021-2/+3
|
* Introduce CLAMP macro. Unify all MIN(MAX(a,b),c) uses.Explorer092016-01-151-4/+0
| | | | | | | | | | | | | | | | | | | | | | | With the CLAMP macro replacing the combination of MIN and MAX, we will have at least two advantages: 1. It's more obvious semantically. 2. There are no more mixes of confusing uses like MIN(MAX(a,b),c) and MAX(MIN(a,b),c) and MIN(a,MAX(b,c)) appearing everywhere. We unify the 'clamping' with a single macro. Note that the behavior of this CLAMP macro is different from the combination `MAX(low,MIN(x,high))`. * This CLAMP macro expands to two comparisons instead of three from MAX and MIN combination. In theory, this makes the code slightly smaller, in case that (low) or (high) or both are computed at runtime, so that compilers cannot optimize them. (The third comparison will matter if (low)>(high); see below.) * CLAMP has a side effect, that if (low)>(high) it will produce weird results. Unlike MIN & MAX which will force either (low) or (high) to win. No assertion of ((low)<=(high)) is done in this macro, for now. This CLAMP macro is implemented like described in glib <http://developer.gnome.org/glib/stable/glib-Standard-Macros.html> and does not handle weird uses like CLAMP(a++, low++, high--) .
* Array entries have been oddly flipped here for years.Hisham Muhammad2015-11-231-2/+1
|
* Fixes for color glitches in ncurses ABI6.Hisham Muhammad2015-08-271-10/+7
| | | | Could no longer reproduce #244 after these fixes.
* include wctype.h for iswprint()Christian Hesse2015-08-251-0/+4
|
* Omit non-printable characters with widechar curses.Hisham Muhammad2015-08-201-1/+1
| | | | Closes PR #111.
* Extra checks.Hisham Muhammad2015-08-201-1/+1
|
* Make Unicode strings safe for ncurses 6 ABI.Hisham Muhammad2015-08-201-4/+4
| | | | Closes #241.
* Do not trust isalpha(c) for values > 255.Hisham Muhammad2015-03-231-1/+1
| | | | | | | Fixes #174. Conflicts: Panel.c
* Changes for supporting separate platform subdirectories.Hisham Muhammad2014-11-241-1/+1
|
* Refactored key handlers.Hisham Muhammad2014-11-191-7/+10
| | | | | | Made the logic more modular, hopefully easier to follow, and removed repeated code. Plus, some optimization in RichString code.
* alignment improvementsHisham Muhammad2014-02-271-0/+1
|
* Add extra checks in configure.ac for different locations of (n)curses.hHisham Muhammad2013-02-261-0/+2
|
* search and filter for the strace and lsof screens!Hisham Muhammad2012-11-101-13/+14
|
* Remove old memory debugging routines. We have Valgrind nowadays.Hisham Muhammad2011-12-261-1/+0
|
* major header cleanupHisham Muhammad2011-12-261-9/+11
|
* try to use unicode headers firstHisham Muhammad2011-11-031-5/+5
|
* Try harder to find the ncurses header, fixes detection in SuSE SLES9.Hisham Muhammad2011-09-081-3/+7
| | | | | (thanks to Moritz Barsnick)

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