aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roff.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-07-14 16:49:39 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-07-14 16:49:39 +0000
commit930e10b0663c7eb1d77bc85b84afe95ca1e113a2 (patch)
tree8676601777b60d78132aa690773ec2e5b58710a7 /roff.c
parent251fb22aeecbbce2c8608e951b9042881f98244e (diff)
downloadmandoc-930e10b0663c7eb1d77bc85b84afe95ca1e113a2.tar.gz
mandoc-930e10b0663c7eb1d77bc85b84afe95ca1e113a2.tar.zst
mandoc-930e10b0663c7eb1d77bc85b84afe95ca1e113a2.zip
Explicitly initialize a variable where the compiler is (understandably)
unable to figure out that it is never used uninitialized. While here, tweak the content of the variable to make its usage easier to understand. No functional change.
Diffstat (limited to 'roff.c')
-rw-r--r--roff.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/roff.c b/roff.c
index 38595a99..2411477e 100644
--- a/roff.c
+++ b/roff.c
@@ -1,4 +1,4 @@
-/* $Id: roff.c,v 1.322 2017/07/13 15:13:18 schwarze Exp $ */
+/* $Id: roff.c,v 1.323 2017/07/14 16:49:39 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -1127,13 +1127,13 @@ roff_res(struct roff *r, struct buf *buf, int ln, int pos)
size_t maxl; /* expected length of the escape name */
size_t naml; /* actual length of the escape name */
enum mandoc_esc esc; /* type of the escape sequence */
- enum mandoc_os os_e; /* kind of RCS id seen */
int inaml; /* length returned from mandoc_escape() */
int expand_count; /* to avoid infinite loops */
int npos; /* position in numeric expression */
int arg_complete; /* argument not interrupted by eol */
int done; /* no more input available */
int deftype; /* type of definition to paste */
+ int rcsid; /* kind of RCS id seen */
char term; /* character terminating the escape */
/* Search forward for comments. */
@@ -1149,20 +1149,21 @@ roff_res(struct roff *r, struct buf *buf, int ln, int pos)
/* Comment found, look for RCS id. */
+ rcsid = 0;
if ((cp = strstr(stesc, "$" "OpenBSD")) != NULL) {
- os_e = MANDOC_OS_OPENBSD;
+ rcsid = 1 << MANDOC_OS_OPENBSD;
cp += 8;
} else if ((cp = strstr(stesc, "$" "NetBSD")) != NULL) {
- os_e = MANDOC_OS_NETBSD;
+ rcsid = 1 << MANDOC_OS_NETBSD;
cp += 7;
}
if (cp != NULL &&
isalnum((unsigned char)*cp) == 0 &&
strchr(cp, '$') != NULL) {
- if (r->man->meta.rcsids & (1 << os_e))
+ if (r->man->meta.rcsids & rcsid)
mandoc_msg(MANDOCERR_RCS_REP, r->parse,
ln, stesc + 1 - buf->buf, stesc + 1);
- r->man->meta.rcsids |= 1 << os_e;
+ r->man->meta.rcsids |= rcsid;
}
/* Handle trailing whitespace. */