mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-15 21:44:36 +03:00
RichString: do not unnecessarily clean whole buffer
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
This commit is contained in:
@ -185,11 +185,11 @@ int RichString_findChar(const RichString* this, char c, int start) {
|
||||
|
||||
#endif /* HAVE_LIBNCURSESW */
|
||||
|
||||
void RichString_prune(RichString* this) {
|
||||
if (this->chlen > RICHSTRING_MAXLEN)
|
||||
void RichString_delete(RichString* this) {
|
||||
if (this->chlen > RICHSTRING_MAXLEN) {
|
||||
free(this->chptr);
|
||||
memset(this, 0, sizeof(RichString));
|
||||
this->chptr = this->chstr;
|
||||
this->chptr = this->chstr;
|
||||
}
|
||||
}
|
||||
|
||||
void RichString_setAttr(RichString* this, int attrs) {
|
||||
|
Reference in New Issue
Block a user