source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: mandoc: Explicitly initialize a variable where the compiler is
Date: Fri, 14 Jul 2017 11:50:09 -0500 (EST)	[thread overview]
Message-ID: <1379674590760034393.enqueue@fantadrom.bsd.lv> (raw)

Log Message:
-----------
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.

Modified Files:
--------------
    mandoc:
        roff.c

Revision Data
-------------
Index: roff.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/roff.c,v
retrieving revision 1.322
retrieving revision 1.323
diff -Lroff.c -Lroff.c -u -p -r1.322 -r1.323
--- roff.c
+++ roff.c
@@ -1127,13 +1127,13 @@ roff_res(struct roff *r, struct buf *buf
 	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
 
 		/* 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. */
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

                 reply	other threads:[~2017-07-14 16:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1379674590760034393.enqueue@fantadrom.bsd.lv \
    --to=schwarze@mandoc.bsd.lv \
    --cc=source@mandoc.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).