Run clang-format over the Mosh source tree. This is a large change and
has been factored into its own commit for auditability. Reproduce it
with
find . -name \*.cc -or -name \*.h | while read f; do clang-format -i --style=file $f; done
Previously, mosh used extensive -I flags and all of the mosh-local
makes it really hard to tell what the proper dependency graph is, so
instead remove the -I arguments in favvor of $(top_srcdir) and qualify
the paths wherever they are used.
ASCII <-> UTF has trivial mappings. Avoid wcrtomb() and mbrtowc().
ISO-8859-1 is all narrow characters, and cheap to test for. It might
be possible to cheaply test other popular UTF blocks and/or planes as
well.
These two changes get 2-3x faster input processing on Linux and
FreeBSD. Performance improvement in actual usage is more modest but
still significant.
* Reduce the size of Terminal::Cell.
* Change colors and attributes in Terminal::Rendition to bitfields/bitmask.
* Change Cells to use UTF-8 strings instead of vector<wchar_t>. Store Rows in a vector instead of a deque.
* Add various Framebuffer::append() methods for more efficient passing of single and repeated characters.
* Change title/icon strings from deques to a vector typedef-- this is more for tidiness than any real performance.
* Fix inefficient STL use around Parser::UTF8Parser.
* Reduce typeid() usage, change some of it to a virtual method
* Do multiple-line scrolls as a single move
This commit is somewhat subtle; it informs Coverity that
Parser::Transition only holds an Action* temporarily, and should never
create/delete one. I believe runtime checkers should also understand
this OK.
Signed-off-by: John Hood <cgull@glup.org>
size_t is unsigned. Fixes two issues found by the Coverity Scan
service, one about the dead code and one about the std::string
exception being uncaught by mosh-server.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>