source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: kristaps@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Move mdoc_macro2len() into mdoc_validate.c as macro2len(), as
Date: Thu, 17 Mar 2011 05:24:51 -0400 (EDT)	[thread overview]
Message-ID: <201103170924.p2H9OpLv014377@krisdoz.my.domain> (raw)

Log Message:
-----------
Move mdoc_macro2len() into mdoc_validate.c as macro2len(), as that's the
only place that it's being used.

Modified Files:
--------------
    mdocml:
        mdoc_strings.c
        mdoc_validate.c

Revision Data
-------------
Index: mdoc_validate.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_validate.c,v
retrieving revision 1.160
retrieving revision 1.161
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.160 -r1.161
--- mdoc_validate.c
+++ mdoc_validate.c
@@ -74,7 +74,8 @@ static	void	 check_args(struct mdoc *, s
 
 static	int	 concat(struct mdoc *, char *, 
 			const struct mdoc_node *, size_t);
-static	enum mdoc_sec a2sec(const char *);
+static	enum mdoc_sec	a2sec(const char *);
+static	size_t		macro2len(enum mdoct);
 
 static	int	 ebool(POST_ARGS);
 static	int	 berr_ge1(POST_ARGS);
@@ -1395,7 +1396,7 @@ post_bl_block_width(POST_ARGS)
 		width = 6;
 	else if (MDOC_MAX == (tok = mdoc_hash_find(n->norm->Bl.width)))
 		return(1);
-	else if (0 == (width = mdoc_macro2len(tok)))  {
+	else if (0 == (width = macro2len(tok)))  {
 		mdoc_nmsg(mdoc, n, MANDOCERR_BADWIDTH);
 		return(1);
 	}
@@ -1452,7 +1453,7 @@ post_bl_block_tag(POST_ARGS)
 			break;
 		}
 
-		if (0 != (ssz = mdoc_macro2len(nn->tok)))
+		if (0 != (ssz = macro2len(nn->tok)))
 			sz = ssz;
 
 		break;
@@ -2292,3 +2293,95 @@ a2sec(const char *p)
 	return(SEC_CUSTOM);
 }
 
+static size_t
+macro2len(enum mdoct macro)
+{
+
+	switch (macro) {
+	case(MDOC_Ad):
+		return(12);
+	case(MDOC_Ao):
+		return(12);
+	case(MDOC_An):
+		return(12);
+	case(MDOC_Aq):
+		return(12);
+	case(MDOC_Ar):
+		return(12);
+	case(MDOC_Bo):
+		return(12);
+	case(MDOC_Bq):
+		return(12);
+	case(MDOC_Cd):
+		return(12);
+	case(MDOC_Cm):
+		return(10);
+	case(MDOC_Do):
+		return(10);
+	case(MDOC_Dq):
+		return(12);
+	case(MDOC_Dv):
+		return(12);
+	case(MDOC_Eo):
+		return(12);
+	case(MDOC_Em):
+		return(10);
+	case(MDOC_Er):
+		return(17);
+	case(MDOC_Ev):
+		return(15);
+	case(MDOC_Fa):
+		return(12);
+	case(MDOC_Fl):
+		return(10);
+	case(MDOC_Fo):
+		return(16);
+	case(MDOC_Fn):
+		return(16);
+	case(MDOC_Ic):
+		return(10);
+	case(MDOC_Li):
+		return(16);
+	case(MDOC_Ms):
+		return(6);
+	case(MDOC_Nm):
+		return(10);
+	case(MDOC_No):
+		return(12);
+	case(MDOC_Oo):
+		return(10);
+	case(MDOC_Op):
+		return(14);
+	case(MDOC_Pa):
+		return(32);
+	case(MDOC_Pf):
+		return(12);
+	case(MDOC_Po):
+		return(12);
+	case(MDOC_Pq):
+		return(12);
+	case(MDOC_Ql):
+		return(16);
+	case(MDOC_Qo):
+		return(12);
+	case(MDOC_So):
+		return(12);
+	case(MDOC_Sq):
+		return(12);
+	case(MDOC_Sy):
+		return(6);
+	case(MDOC_Sx):
+		return(16);
+	case(MDOC_Tn):
+		return(10);
+	case(MDOC_Va):
+		return(12);
+	case(MDOC_Vt):
+		return(12);
+	case(MDOC_Xr):
+		return(10);
+	default:
+		break;
+	};
+	return(0);
+}
Index: mdoc_strings.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_strings.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -Lmdoc_strings.c -Lmdoc_strings.c -u -p -r1.27 -r1.28
--- mdoc_strings.c
+++ mdoc_strings.c
@@ -30,95 +30,3 @@
 #include "libmdoc.h"
 
 /* FIXME: move this into an editable .in file. */
-size_t
-mdoc_macro2len(enum mdoct macro)
-{
-
-	switch (macro) {
-	case(MDOC_Ad):
-		return(12);
-	case(MDOC_Ao):
-		return(12);
-	case(MDOC_An):
-		return(12);
-	case(MDOC_Aq):
-		return(12);
-	case(MDOC_Ar):
-		return(12);
-	case(MDOC_Bo):
-		return(12);
-	case(MDOC_Bq):
-		return(12);
-	case(MDOC_Cd):
-		return(12);
-	case(MDOC_Cm):
-		return(10);
-	case(MDOC_Do):
-		return(10);
-	case(MDOC_Dq):
-		return(12);
-	case(MDOC_Dv):
-		return(12);
-	case(MDOC_Eo):
-		return(12);
-	case(MDOC_Em):
-		return(10);
-	case(MDOC_Er):
-		return(17);
-	case(MDOC_Ev):
-		return(15);
-	case(MDOC_Fa):
-		return(12);
-	case(MDOC_Fl):
-		return(10);
-	case(MDOC_Fo):
-		return(16);
-	case(MDOC_Fn):
-		return(16);
-	case(MDOC_Ic):
-		return(10);
-	case(MDOC_Li):
-		return(16);
-	case(MDOC_Ms):
-		return(6);
-	case(MDOC_Nm):
-		return(10);
-	case(MDOC_No):
-		return(12);
-	case(MDOC_Oo):
-		return(10);
-	case(MDOC_Op):
-		return(14);
-	case(MDOC_Pa):
-		return(32);
-	case(MDOC_Pf):
-		return(12);
-	case(MDOC_Po):
-		return(12);
-	case(MDOC_Pq):
-		return(12);
-	case(MDOC_Ql):
-		return(16);
-	case(MDOC_Qo):
-		return(12);
-	case(MDOC_So):
-		return(12);
-	case(MDOC_Sq):
-		return(12);
-	case(MDOC_Sy):
-		return(6);
-	case(MDOC_Sx):
-		return(16);
-	case(MDOC_Tn):
-		return(10);
-	case(MDOC_Va):
-		return(12);
-	case(MDOC_Vt):
-		return(12);
-	case(MDOC_Xr):
-		return(10);
-	default:
-		break;
-	};
-	return(0);
-}
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2011-03-17  9:24 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=201103170924.p2H9OpLv014377@krisdoz.my.domain \
    --to=kristaps@mdocml.bsd.lv \
    --cc=source@mdocml.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).