From 829f43f3cec66bb30785ad569b0ceaeaf9cce55d Mon Sep 17 00:00:00 2001 From: espie Date: Thu, 21 Aug 2008 20:59:14 +0000 Subject: [PATCH] use unsigned char for buffers, allow differentiating between EOF and y". okay otto@ --- usr.bin/m4/extern.h | 14 +++++++------- usr.bin/m4/misc.c | 18 +++++++++--------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/usr.bin/m4/extern.h b/usr.bin/m4/extern.h index fc5050a4514..26c8afaef52 100644 --- a/usr.bin/m4/extern.h +++ b/usr.bin/m4/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.47 2008/08/16 12:23:50 espie Exp $ */ +/* $OpenBSD: extern.h,v 1.48 2008/08/21 20:59:14 espie Exp $ */ /* $NetBSD: extern.h,v 1.3 1996/01/13 23:25:24 pk Exp $ */ /*- @@ -109,7 +109,7 @@ extern void usage(void); extern void resizedivs(int); extern size_t buffer_mark(void); extern void dump_buffer(FILE *, size_t); -extern void m4errx(int, const char *, ...); +extern void __dead m4errx(int, const char *, ...); extern int obtain_char(struct input_file *); extern void set_input(struct input_file *, FILE *, const char *); @@ -133,7 +133,7 @@ extern void release_input(struct input_file *); /* and corresponding exposure for local symbols */ extern void enlarge_bufspace(void); extern void enlarge_strspace(void); -extern char *endpbb; +extern unsigned char *endpbb; extern char *endest; /* trace.c */ @@ -156,10 +156,10 @@ extern int fp; /* m4 call frame pointer */ extern int ilevel; /* input file stack pointer */ extern int oindex; /* diversion index. */ extern int sp; /* current m4 stack pointer */ -extern char *bp; /* first available character */ -extern char *buf; /* push-back buffer */ -extern char *bufbase; /* buffer base for this ilevel */ -extern char *bbase[]; /* buffer base per ilevel */ +extern unsigned char *bp; /* first available character */ +extern unsigned char *buf; /* push-back buffer */ +extern unsigned char *bufbase; /* buffer base for this ilevel */ +extern unsigned char *bbase[]; /* buffer base per ilevel */ extern char ecommt[MAXCCHARS+1];/* end character for comment */ extern char *ep; /* first free char in strspace */ extern char lquote[MAXCCHARS+1];/* left quote character (`) */ diff --git a/usr.bin/m4/misc.c b/usr.bin/m4/misc.c index 2c321882298..38637b1a8dd 100644 --- a/usr.bin/m4/misc.c +++ b/usr.bin/m4/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.39 2008/08/16 12:23:50 espie Exp $ */ +/* $OpenBSD: misc.c,v 1.40 2008/08/21 20:59:14 espie Exp $ */ /* $NetBSD: misc.c,v 1.6 1995/09/28 05:37:41 tls Exp $ */ /* @@ -54,11 +54,11 @@ char *endest; /* end of string space */ static size_t strsize = STRSPMAX; static size_t bufsize = BUFSIZE; -char *buf; /* push-back buffer */ -char *bufbase; /* the base for current ilevel */ -char *bbase[MAXINP]; /* the base for each ilevel */ -char *bp; /* first available character */ -char *endpbb; /* end of push-back buffer */ +unsigned char *buf; /* push-back buffer */ +unsigned char *bufbase; /* the base for current ilevel */ +unsigned char *bbase[MAXINP]; /* the base for each ilevel */ +unsigned char *bp; /* first available character */ +unsigned char *endpbb; /* end of push-back buffer */ /* @@ -163,7 +163,7 @@ initspaces() strspace = xalloc(strsize+1, NULL); ep = strspace; endest = strspace+strsize; - buf = (char *)xalloc(bufsize, NULL); + buf = (unsigned char *)xalloc(bufsize, NULL); bufbase = buf; bp = buf; endpbb = buf + bufsize; @@ -195,7 +195,7 @@ enlarge_strspace() void enlarge_bufspace() { - char *newbuf; + unsigned char *newbuf; int i; bufsize += bufsize/2; @@ -418,7 +418,7 @@ buffer_mark() void dump_buffer(FILE *f, size_t m) { - char *s; + unsigned char *s; for (s = bp; s-buf > m;) fputc(*--s, f); -- 2.20.1