From 061e52ca23a19767789adf70d0effd6dd1e160be Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Tue, 16 Aug 2022 17:29:19 +0000 Subject: Even though the constant ASCII_ESC is only used in the roff pre-parser roff.c, move it to the top level include file mandoc.h to reduce the risk of causing clashes when introducing new ASCII_* constants in the future. --- usr.bin/mandoc/roff.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'usr.bin/mandoc/roff.c') diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c index 856adb9ae57..3512ceda94c 100644 --- a/usr.bin/mandoc/roff.c +++ b/usr.bin/mandoc/roff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: roff.c,v 1.266 2022/06/07 09:41:22 schwarze Exp $ */ +/* $OpenBSD: roff.c,v 1.267 2022/08/16 17:29:18 schwarze Exp $ */ /* * Copyright (c) 2010-2015, 2017-2022 Ingo Schwarze * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons @@ -38,14 +38,6 @@ #include "tbl_parse.h" #include "eqn_parse.h" -/* - * ASCII_ESC is used to signal from roff_getarg() to roff_expand() - * that an escape sequence resulted from copy-in processing and - * needs to be checked or interpolated. As it is used nowhere - * else, it is defined here rather than in a header file. - */ -#define ASCII_ESC 27 - /* Maximum number of string expansions per line, to break infinite loops. */ #define EXPAND_LIMIT 1000 @@ -1638,8 +1630,13 @@ roff_getarg(struct roff *r, char **cpp, int ln, int *pos) cp++; break; case '\\': - newesc = 1; + /* + * Signal to roff_expand() that an escape + * sequence resulted from copy-in processing + * and needs to be checked or interpolated. + */ cp[-pairs] = ASCII_ESC; + newesc = 1; pairs++; cp++; break; -- cgit v1.2.3