From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: docbook2mdoc: provide a simple function to generate a text node
Date: Sun, 28 Apr 2019 10:32:35 -0500 (EST) [thread overview]
Message-ID: <e3feb0a38054955d@fantadrom.bsd.lv> (raw)
Log Message:
-----------
provide a simple function to generate a text node
Modified Files:
--------------
docbook2mdoc:
docbook2mdoc.c
node.c
node.h
parse.c
Revision Data
-------------
Index: node.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/node.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -Lnode.c -Lnode.c -u -p -r1.24 -r1.25
--- node.c
+++ node.c
@@ -261,6 +261,17 @@ pnode_alloc(struct pnode *np)
return n;
}
+struct pnode *
+pnode_alloc_text(struct pnode *np, const char *text)
+{
+ struct pnode *n;
+
+ n = pnode_alloc(np);
+ n->node = NODE_TEXT;
+ n->b = xstrdup(text);
+ return n;
+}
+
/*
* Recursively free a node (NULL is ok).
*/
Index: docbook2mdoc.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/docbook2mdoc.c,v
retrieving revision 1.139
retrieving revision 1.140
diff -Ldocbook2mdoc.c -Ldocbook2mdoc.c -u -p -r1.139 -r1.140
--- docbook2mdoc.c
+++ docbook2mdoc.c
@@ -898,9 +898,7 @@ pnode_printrefentry(struct format *f, st
nc = pnode_alloc(match);
nc->node = NODE_TITLE;
nc->flags |= NFLAG_SPC;
- nc = pnode_alloc(nc);
- nc->node = NODE_TEXT;
- nc->b = xstrdup("AUTHORS");
+ nc = pnode_alloc_text(nc, "AUTHORS");
nc->flags |= NFLAG_SPC;
if (later == NULL)
TAILQ_INSERT_TAIL(&n->childq, match, child);
Index: node.h
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/node.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -Lnode.h -Lnode.h -u -p -r1.33 -r1.34
--- node.h
+++ node.h
@@ -261,6 +261,7 @@ const char *pnode_name(enum nodeid);
enum nodeclass pnode_class(enum nodeid);
struct pnode *pnode_alloc(struct pnode *);
+struct pnode *pnode_alloc_text(struct pnode *, const char *);
void pnode_unlink(struct pnode *);
void pnode_unlinksub(struct pnode *);
enum attrval pnode_getattr(struct pnode *, enum attrkey);
Index: parse.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/parse.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -Lparse.c -Lparse.c -u -p -r1.53 -r1.54
--- parse.c
+++ parse.c
@@ -361,10 +361,8 @@ pnode_closetext(struct parse *p, int che
/* Move the last word into its own node, for use with .Pf. */
- n = pnode_alloc(p->cur);
- n->node = NODE_TEXT;
+ n = pnode_alloc_text(p->cur, last_word);
n->flags |= NFLAG_SPC;
- n->b = xstrdup(last_word);
}
static void
--
To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv
reply other threads:[~2019-04-28 15:32 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=e3feb0a38054955d@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).