summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-07-27 12:43:02 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-07-27 12:43:02 +0000
commit6d990f71285ba7cd96f7f25154866e8e4c07efa0 (patch)
treefe763c714500c614a7ad8cca99b5ad18e8031612
parent96482854006a9cdd85cb178e59313f4d7edfe4ec (diff)
downloadmandoc-6d990f71285ba7cd96f7f25154866e8e4c07efa0.tar.gz
Simply word allocation in libmdoc and libman.
-rw-r--r--man.c9
-rw-r--r--mdoc.c9
2 files changed, 2 insertions, 16 deletions
diff --git a/man.c b/man.c
index 3bfbb4a4..b13039e8 100644
--- a/man.c
+++ b/man.c
@@ -320,16 +320,9 @@ int
man_word_alloc(struct man *m, int line, int pos, const char *word)
{
struct man_node *n;
- size_t sv, len;
-
- len = strlen(word);
n = man_node_alloc(m, line, pos, MAN_TEXT, MAN_MAX);
- n->string = mandoc_malloc(len + 1);
- sv = strlcpy(n->string, word, len + 1);
-
- /* Prohibit truncation. */
- assert(sv < len + 1);
+ n->string = mandoc_strdup(word);
if ( ! man_node_append(m, n))
return(0);
diff --git a/mdoc.c b/mdoc.c
index 6436e36c..26788b0a 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -568,16 +568,9 @@ int
mdoc_word_alloc(struct mdoc *m, int line, int pos, const char *p)
{
struct mdoc_node *n;
- size_t sv, len;
-
- len = strlen(p);
n = node_alloc(m, line, pos, MDOC_MAX, MDOC_TEXT);
- n->string = mandoc_malloc(len + 1);
- sv = strlcpy(n->string, p, len + 1);
-
- /* Prohibit truncation. */
- assert(sv < len + 1);
+ n->string = mandoc_strdup(p);
if ( ! node_append(m, n))
return(0);