diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2022-06-02 11:29:07 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2022-06-02 11:29:07 +0000 |
commit | 3f1a8f780a3e6cd71d71a29bce66571cc2fad12e (patch) | |
tree | 68fd8bdd83e7e95f447c3828061bb4cf565aa02b /roff.c | |
parent | 19ceeb7841194569b42a6e68a0db6e9de594ee5e (diff) | |
download | mandoc-3f1a8f780a3e6cd71d71a29bce66571cc2fad12e.tar.gz |
Avoid the layering violation of re-parsing for \E in roff_expand().
To that end, add another argument to roff_escape()
returning the index of the escape name.
This also makes the code in roff_escape() a bit more uniform
in so far as it no longer needs the "char esc_name" local variable
but now does everything with indices into buf[].
No functional change.
Diffstat (limited to 'roff.c')
-rw-r--r-- | roff.c | 13 |
1 files changed, 2 insertions, 11 deletions
@@ -1410,8 +1410,8 @@ roff_expand(struct roff *r, struct buf *buf, int ln, int pos, char ec) * it to backslashes and translate backslashes to \e. */ - if (roff_escape(buf->buf, ln, pos, - &iesc, &iarg, &iendarg, &iend) != ESCAPE_EXPAND) { + if (roff_escape(buf->buf, ln, pos, &iesc, &inam, + &iarg, &iendarg, &iend) != ESCAPE_EXPAND) { while (pos < iend) { if (buf->buf[pos] == ec) { buf->buf[pos] = '\\'; @@ -1428,15 +1428,6 @@ roff_expand(struct roff *r, struct buf *buf, int ln, int pos, char ec) continue; } - /* - * Treat "\E" just like "\"; - * it only makes a difference in copy mode. - */ - - inam = iesc + 1; - while (buf->buf[inam] == 'E') - inam++; - /* Handle expansion. */ res = NULL; |