commit 11c2b059294718c5411469f745a9566f9b5e255d parent 99446d7e3f9af6a1dea8c29935673a63b8b97aac Author: hhvn <dev@hhvn.uk> Date: Thu, 24 Nov 2022 22:51:18 +0000 Improve checkalloc script output Diffstat:
M | dev/checkalloc.sh | | | 16 | +++++++++++++--- |
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/dev/checkalloc.sh b/dev/checkalloc.sh @@ -3,6 +3,16 @@ # GNU grep only command -v ggrep >/dev/null && grep="ggrep" || grep="grep" -# Final grep is required for the return value to indicate -# existance of any calls to non error-checking allocators -! $grep -nE '[^fen](malloc|calloc|realloc|strdup)\(' src/*.c | $grep -v mem.c | $grep . +# Final grep is required for the return value to indicate existance +$grep --color=always -nE '[^fen](malloc|calloc|realloc|strdup)\(' src/*.c | + $grep -v mem.c | + $grep . && { + tput setaf 160 + tput bold + printf '>>> ' + tput sgr0 + printf 'allocations should be made with functions defined in src/mem.c\n' + return 1 +} + +return 0