Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
jsonn committed Jan 29, 2012
1 parent 77fdeb5 commit 464fea0
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions makemandb.c
Expand Up @@ -842,9 +842,7 @@ pmdoc_Nd(const struct mdoc_node *n, mandb_rec *rec)
static void
pmdoc_macro_handler(const struct mdoc_node *n, mandb_rec *rec, enum mdoct doct)
{
char *buf = NULL;
size_t len;

const struct mdoc_node *sn;;
assert(n);

switch (doct) {
Expand All @@ -863,24 +861,25 @@ pmdoc_macro_handler(const struct mdoc_node *n, mandb_rec *rec, enum mdoct doct)

if (n && n->type != MDOC_TEXT)
return;
len = strlen(n->string);
concat2(&buf, n->string, len);
sn = n;
if (n->next)
n = n->next;

while (n->type != MDOC_TEXT && n->next)
n = n->next;

if (n && n->type == MDOC_TEXT) {
buf = erealloc(buf, len + 4);
size_t len = strlen(sn->string);
char *buf = emalloc(len + 4);
memcpy(buf, n->string, len);
buf[len] = '(';
buf[len + 1] = n->string[0];
buf[len + 2] = ')';
buf[len + 3] = 0;
mdoc_parse_section(n->sec, buf, rec);
free(buf);
}

free(buf);
break;

/* Parse the .Pp macro to add a new line */
Expand Down

0 comments on commit 464fea0

Please sign in to comment.