Simplify and improve justification step of status formatting, and use the same code for $statsparse()
Separate out the justification step of make_status() into a new function, so it can be wired in to stat_convert_format() as well. This makes $statsparse() work correctly with right-justified status formats. Minimise the amount of copying around that is done during the justification - instead, we can just remember pointers into the buffer returned by strip_ansi() for the left-hand-side, right-hand-side and padding character. Don't keep concatenating onto the same buffer with strlcat() when generating the padding - that gives n^2 behaviour. Instead keep a pointer to the current end and concatenate there. Ensure buffer is null-terminated before calling strlcat() on it, in stat_convert_format().
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
[Changes 1.2.2]
|
||||
|
||||
* Fix $statsparse() scripting function to handle right-justified status
|
||||
formats correctly and improve efficiency of all status formatting. (caf)
|
||||
|
||||
* Restore terminal settings after flushing output, not before. (caf)
|
||||
|
||||
* Remove exported function create_server_list(). (caf)
|
||||
|
||||
Reference in New Issue
Block a user