source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: kristaps@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Move mdoc_str2sec() into mdoc_validate.c as a2sec(), as that's
Date: Thu, 17 Mar 2011 05:22:39 -0400 (EDT)	[thread overview]
Message-ID: <201103170922.p2H9Md8O013495@krisdoz.my.domain> (raw)

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

Modified Files:
--------------
    mdocml:
        libmdoc.h
        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.159
retrieving revision 1.160
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.159 -r1.160
--- mdoc_validate.c
+++ mdoc_validate.c
@@ -74,6 +74,7 @@ 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	int	 ebool(POST_ARGS);
 static	int	 berr_ge1(POST_ARGS);
@@ -321,6 +322,30 @@ static	const enum mdoct rsord[RSORD_MAX]
 	MDOC__U
 };
 
+static	const char * const secnames[SEC__MAX] = {
+	NULL,
+	"NAME",
+	"LIBRARY",
+	"SYNOPSIS",
+	"DESCRIPTION",
+	"IMPLEMENTATION NOTES",
+	"RETURN VALUES",
+	"ENVIRONMENT",
+	"FILES",
+	"EXIT STATUS",
+	"EXAMPLES",
+	"DIAGNOSTICS",
+	"COMPATIBILITY",
+	"ERRORS",
+	"SEE ALSO",
+	"STANDARDS",
+	"HISTORY",
+	"AUTHORS",
+	"CAVEATS",
+	"BUGS",
+	"SECURITY CONSIDERATIONS",
+	NULL
+};
 
 int
 mdoc_valid_pre(struct mdoc *mdoc, struct mdoc_node *n)
@@ -1821,7 +1846,7 @@ post_sh_head(POST_ARGS)
 	if ( ! concat(mdoc, buf, mdoc->last->child, BUFSIZ))
 		return(0);
 
-	sec = mdoc_str2sec(buf);
+	sec = a2sec(buf);
 
 	/* The NAME should be first. */
 
@@ -2253,5 +2278,17 @@ concat(struct mdoc *m, char *p, const st
 	}
 
 	return(1);
+}
+
+static enum mdoc_sec 
+a2sec(const char *p)
+{
+	int		 i;
+
+	for (i = 0; i < (int)SEC__MAX; i++) 
+		if (secnames[i] && 0 == strcmp(p, secnames[i]))
+			return((enum mdoc_sec)i);
+
+	return(SEC_CUSTOM);
 }
 
Index: libmdoc.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/libmdoc.h,v
retrieving revision 1.65
retrieving revision 1.66
diff -Llibmdoc.h -Llibmdoc.h -u -p -r1.65 -r1.66
--- libmdoc.h
+++ libmdoc.h
@@ -108,7 +108,6 @@ void		  mdoc_node_delete(struct mdoc *, 
 void		  mdoc_hash_init(void);
 enum mdoct	  mdoc_hash_find(const char *);
 size_t		  mdoc_isescape(const char *);
-enum	mdoc_sec  mdoc_str2sec(const char *);
 time_t		  mdoc_atotime(const char *);
 size_t		  mdoc_macro2len(enum mdoct);
 const char	 *mdoc_a2att(const char *);
Index: mdoc_strings.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_strings.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -Lmdoc_strings.c -Lmdoc_strings.c -u -p -r1.26 -r1.27
--- mdoc_strings.c
+++ mdoc_strings.c
@@ -29,44 +29,6 @@
 #include "mandoc.h"
 #include "libmdoc.h"
 
-static	const char * const secnames[SEC__MAX] = {
-	NULL,
-	"NAME",
-	"LIBRARY",
-	"SYNOPSIS",
-	"DESCRIPTION",
-	"IMPLEMENTATION NOTES",
-	"RETURN VALUES",
-	"ENVIRONMENT",
-	"FILES",
-	"EXIT STATUS",
-	"EXAMPLES",
-	"DIAGNOSTICS",
-	"COMPATIBILITY",
-	"ERRORS",
-	"SEE ALSO",
-	"STANDARDS",
-	"HISTORY",
-	"AUTHORS",
-	"CAVEATS",
-	"BUGS",
-	"SECURITY CONSIDERATIONS",
-	NULL
-};
-
-enum mdoc_sec 
-mdoc_str2sec(const char *p)
-{
-	int		 i;
-
-	for (i = 0; i < (int)SEC__MAX; i++) 
-		if (secnames[i] && 0 == strcmp(p, secnames[i]))
-			return((enum mdoc_sec)i);
-
-	return(SEC_CUSTOM);
-}
-
-
 /* FIXME: move this into an editable .in file. */
 size_t
 mdoc_macro2len(enum mdoct macro)
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2011-03-17  9:22 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=201103170922.p2H9Md8O013495@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).