From: kristaps@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Clean-up: remove a function only called once.
Date: Sat, 18 Jun 2011 12:29:38 -0400 (EDT) [thread overview]
Message-ID: <201106181629.p5IGTcsf018123@krisdoz.my.domain> (raw)
Log Message:
-----------
Clean-up: remove a function only called once.
Modified Files:
--------------
mdocml:
mdoc_argv.c
Revision Data
-------------
Index: mdoc_argv.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_argv.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -Lmdoc_argv.c -Lmdoc_argv.c -u -p -r1.78 -r1.79
--- mdoc_argv.c
+++ mdoc_argv.c
@@ -55,8 +55,6 @@ struct mdocarg {
static enum margserr args(struct mdoc *, int, int *,
char *, enum argsflag, char **);
static int args_checkpunct(const char *, int);
-static int argv(struct mdoc *, int,
- struct mdoc_argv *, int *, char *);
static int argv_single(struct mdoc *, int,
struct mdoc_argv *, int *, char *);
static int argv_opt_single(struct mdoc *, int,
@@ -345,8 +343,22 @@ mdoc_argv(struct mdoc *m, int line, enum
while (buf[*pos] && ' ' == buf[*pos])
(*pos)++;
- if ( ! argv(m, line, &tmp, pos, buf))
- return(ARGV_ERROR);
+ switch (argvflags[tmp.arg]) {
+ case (ARGV_SINGLE):
+ if ( ! argv_single(m, line, &tmp, pos, buf))
+ return(ARGV_ERROR);
+ break;
+ case (ARGV_MULTI):
+ if ( ! argv_multi(m, line, &tmp, pos, buf))
+ return(ARGV_ERROR);
+ break;
+ case (ARGV_OPT_SINGLE):
+ if ( ! argv_opt_single(m, line, &tmp, pos, buf))
+ return(ARGV_ERROR);
+ break;
+ case (ARGV_NONE):
+ break;
+ }
if (NULL == (arg = *v))
arg = *v = mandoc_calloc(1, sizeof(struct mdoc_arg));
@@ -680,9 +692,6 @@ argv_opt_single(struct mdoc *m, int line
return(1);
}
-/*
- * Parse a single, mandatory value from the stream.
- */
static int
argv_single(struct mdoc *m, int line,
struct mdoc_argv *v, int *pos, char *buf)
@@ -703,36 +712,6 @@ argv_single(struct mdoc *m, int line,
v->sz = 1;
v->value = mandoc_malloc(sizeof(char *));
v->value[0] = mandoc_strdup(p);
-
- return(1);
-}
-
-/*
- * Determine rules for parsing arguments. Arguments can either accept
- * no parameters, an optional single parameter, one parameter, or
- * multiple parameters.
- */
-static int
-argv(struct mdoc *mdoc, int line,
- struct mdoc_argv *v, int *pos, char *buf)
-{
-
- v->sz = 0;
- v->value = NULL;
-
- switch (argvflags[v->arg]) {
- case (ARGV_SINGLE):
- return(argv_single(mdoc, line, v, pos, buf));
- case (ARGV_MULTI):
- return(argv_multi(mdoc, line, v, pos, buf));
- case (ARGV_OPT_SINGLE):
- return(argv_opt_single(mdoc, line, v, pos, buf));
- case (ARGV_NONE):
- break;
- default:
- abort();
- /* NOTREACHED */
- }
return(1);
}
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
reply other threads:[~2011-06-18 16:29 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=201106181629.p5IGTcsf018123@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).