Hello,
I've been working on st for a few days now and accumulated a few commits so I
thought I'd merge the latest upstream changes and send them in. Apologies in
advance for the number of emails! Also sorry if I've done something wrong, I'm
not used to emailing patches like this.
These patches fix all errors and warnings I found when building with lots of
compiler warning flags enabled, and running tools like cppcheck and valgrind.
There's lots of type and const correctness fixes, conflicting variable names,
a couple of memory leaks, and stylistic stuff like reducing variable scope.
Also avoid linking with libm and make building on OpenBSD a bit more
straightforward.
Thanks!
Oliver Galvin (24):
add gitignore
avoid unnecessarily checking if an unsigned variable is < 0, fixes
cppcheck warnings
Reduce variable scope where possible, fix cppcheck style warnings
use const where possible, avoid discarding const, fixes errors from
-Wdiscarded-qualifiers
avoid warnings from -Wunused-parameter
fix warnings from -Wimplicit-fallthrough
fix warning from -Wmaybe-uninitialized
fix warnings from -Wsign-compare and -Wtype-limits. also make sure we
use size_t for len variables
avoid redundant declaration and old-style function definition
fix -Wshadow warnings, due to variable names conflicting with global
variables. also we don't need to pass global variables to xinit()
rename variable to fix cppcheck shadow warning, due to variable name
conflicting with function
fix remaining cppcheck warnings: reduce scope of some variables, and
avoid compiling selcheck_ when it's not used, by adding a new
setting in config.h
clean up two warnings from clang about initialisation and sign
comparison
now st can build without errors/warnings with -Wall -Wextra -Wpedantic
enabled, enable them by default
update config.def.h with necessary changes after my previous commits.
uses const everywhere and adds the SELCLEAR option
avoid leaking memory when xrealloc/xstrdup fail, by freeing memory
before die()
use EXIT_SUCCESS/FAILURE
use compiler attribute to check die() parameters, and fix relevant
warning from clang
improve type and const correctness by using more correct types. fixes
a bunch of -Wcast-qual warnings
use EXIT_FAILURE/SUCCESS on exit
avoid unnecessarily linking to the math library, and detect openbsd
automatically in makefile
fix memory leak - destroy patterns in xloadfont
stylistic stuff: Tidy up indentation, small fixes to comments, etc.
link with librt on non-openbsd systems, I forgot to uncomment
--
2.20.1