From f7d6884dedabaa237056164ec6d90335de8025cb Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Mon, 18 Apr 2022 10:24:11 -0400 Subject: [PATCH] cppcheck cleanup. --- Makefile | 2 +- main.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 84039b4..92e97da 100644 --- a/Makefile +++ b/Makefile @@ -136,7 +136,7 @@ debug: CCFLAGS += -fsanitize=address debug: CCFLAGS += -fsanitize=undefined debug: linty -PYSUPPRESSIONS = --suppress=missingIncludeSystem --suppress=invalidscanf +CSUPPRESSIONS = --suppress=missingIncludeSystem --suppress=invalidscanf cppcheck: cppcheck -I. --template gcc --enable=all $(CSUPPRESSIONS) *.[ch] diff --git a/main.c b/main.c index 0bc737b..514ae59 100644 --- a/main.c +++ b/main.c @@ -147,7 +147,7 @@ char *myreadline(const char *prompt) if (settings.argc == 0) return readline(prompt); - char *buf = malloc(BUFSIZ); + char *buf = malloc(LINESIZE+1); for (;;) { if (settings.scriptfp == NULL || feof(settings.scriptfp)) { if (settings.optind >= settings.argc) { @@ -169,7 +169,7 @@ char *myreadline(const char *prompt) free(buf); // LCOV_EXCL_LINE return readline(prompt); // LCOV_EXCL_LINE } else { - char *ln = fgets(buf, BUFSIZ-1, settings.scriptfp); + char *ln = fgets(buf, LINESIZE, settings.scriptfp); if (ln != NULL) { fputs(PROMPT, stdout); fputs(ln, stdout); -- 2.31.1