mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 20:24:35 +03:00
Use RichString_appendnAscii where possible
`RichString_appendnAscii()` avoids a `strlen(3)` call over ` RichString_appendAscii()`. Use the former where the length is available from a previous checked `snprintf(3)` call. Keep `RichString_appendAscii()` when passing a string literal and rely on compilers to optimize the `strlen(3)` call away.
This commit is contained in:

committed by
cgzones

parent
099dab88be
commit
436808ff99
@ -53,7 +53,7 @@ static void NumberItem_display(const Object* cast, RichString* out) {
|
||||
} else {
|
||||
written = xSnprintf(buffer, sizeof(buffer), "%d", NumberItem_get(this));
|
||||
}
|
||||
RichString_appendAscii(out, CRT_colors[CHECK_MARK], buffer);
|
||||
RichString_appendnAscii(out, CRT_colors[CHECK_MARK], buffer, written);
|
||||
RichString_appendAscii(out, CRT_colors[CHECK_BOX], "]");
|
||||
for (int i = written; i < 5; i++) {
|
||||
RichString_appendAscii(out, CRT_colors[CHECK_BOX], " ");
|
||||
|
Reference in New Issue
Block a user