From: Alan Cox Date: Wed, 22 Nov 2017 17:51:12 +0000 (+0000) Subject: 6502: more app tweaks for 6502 - keep large arrays off stack X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=bdb357ca1769cfcaf485acab13b12135892e624c;p=FUZIX.git 6502: more app tweaks for 6502 - keep large arrays off stack --- diff --git a/Applications/MWC/cmd/moo.c b/Applications/MWC/cmd/moo.c index 1aba3501..f08218d6 100644 --- a/Applications/MWC/cmd/moo.c +++ b/Applications/MWC/cmd/moo.c @@ -27,11 +27,12 @@ int badline(char *s, int l) return (0); } +static char line[256]; + int main(int argc, char *argv[]) { char moo[10]; int nmoo; - char line[256]; int i, j; int nbull, ncow; union { diff --git a/Applications/MWC/cmd/pr.c b/Applications/MWC/cmd/pr.c index e51d87fa..b788fc34 100644 --- a/Applications/MWC/cmd/pr.c +++ b/Applications/MWC/cmd/pr.c @@ -255,10 +255,11 @@ FILE *openf(char *file) * Formfeed advances output of that stream to the next page. * Eof is only indicated when all streams give this condition. */ +static char lbuf[LSIZE]; + int page1(void (*putline) (char *, int)) { int i, j; - char lbuf[LSIZE]; for (i = 0; i < length; ++i) { for (j = 0; j < ncol; ++j) { @@ -289,7 +290,6 @@ int page1(void (*putline) (char *, int)) int page2(void (*putline) (char *, int)) { int i, j, k; - char lbuf[LSIZE]; for (i = 0; i < (ncol - 1) * length; ++i) { if ((i % length) == 0) @@ -333,7 +333,7 @@ int page2(void (*putline) (char *, int)) * many columns per file (page2). The latter requires page buffering. * init( ) makes this selection. */ -char **init(int ac, char **av) +char **init(int ac, char *av[]) { int mar = MARGIN; static char obuf[BUFSIZ]; @@ -400,7 +400,7 @@ char **init(int ac, char **av) if (mflag && av[0]) { ncol = 0; do { - f[ncol++].f_stream = openf(av++[0]); + f[ncol++].f_stream = openf((av++)[0]); } while (av[0]); }