source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Move mdoc_str2sec() into mdoc_validate.c as a2sec(), as that's
@ 2011-03-17  9:22 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2011-03-17  9:22 UTC (permalink / raw)
  To: source

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-03-17  9:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-17  9:22 mdocml: Move mdoc_str2sec() into mdoc_validate.c as a2sec(), as that's kristaps

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).