cppcheck cleanup.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 18 Apr 2022 14:24:11 +0000 (10:24 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 18 Apr 2022 14:24:11 +0000 (10:24 -0400)
Makefile
main.c

index 84039b4e8df8a5a698fd77cb30a5d19f4ae66d76..92e97da6fff4ed32e38abb4b0c62c7b128dff679 100644 (file)
--- 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 0bc737b3dea7f38c59aade10379a8b24f2750968..514ae598c97e3f01f898076395c9e92754cb079a 100644 (file)
--- 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);