1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

use unsigned char for buffers, allow differentiating between EOF and y".

okay otto@
This commit is contained in:
espie 2008-08-21 20:59:14 +00:00
parent 7e68424de2
commit 829f43f3ce
2 changed files with 16 additions and 16 deletions

View File

@ -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 (`) */

View File

@ -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);