version 1.5, 2008/12/28 00:34:20 |
version 1.18, 2009/01/05 17:57:08 |
Line 80 const char *const __mdoc_argnames[MDOC_ARG_MAX] = { |
|
Line 80 const char *const __mdoc_argnames[MDOC_ARG_MAX] = { |
|
"xsh5", "xns5", "xns5.2d2.0", |
"xsh5", "xns5", "xns5.2d2.0", |
"xcurses4.2", "susv2", "susv3", |
"xcurses4.2", "susv2", "susv3", |
"svid4", "filled", "words", |
"svid4", "filled", "words", |
|
"emphasis", "symbolic", |
}; |
}; |
|
|
const struct mdoc_macro __mdoc_macros[MDOC_MAX] = { |
const struct mdoc_macro __mdoc_macros[MDOC_MAX] = { |
{ NULL, 0 }, /* \" */ |
{ NULL, 0 }, /* \" */ |
{ macro_prologue_ddate, 0 }, /* Dd */ |
{ macro_prologue, MDOC_PROLOGUE }, /* Dd */ |
{ macro_prologue_dtitle, 0 }, /* Dt */ |
{ macro_prologue, MDOC_PROLOGUE }, /* Dt */ |
{ macro_prologue_os, 0 }, /* Os */ |
{ macro_prologue, MDOC_PROLOGUE }, /* Os */ |
{ macro_scoped_implicit, 0 }, /* Sh */ |
{ macro_scoped, 0 }, /* Sh */ |
{ macro_scoped_implicit, 0 }, /* Ss */ |
{ macro_scoped, 0 }, /* Ss */ |
{ macro_text, 0 }, /* Pp */ |
{ macro_text, 0 }, /* Pp */ |
{ NULL, 0 }, /* D1 */ |
{ macro_scoped_line, 0 }, /* D1 */ |
{ NULL, 0 }, /* Dl */ |
{ macro_scoped_line, 0 }, /* Dl */ |
{ macro_scoped_explicit, MDOC_EXPLICIT }, /* Bd */ |
{ macro_scoped, MDOC_EXPLICIT }, /* Bd */ |
{ macro_scoped_explicit, 0 }, /* Ed */ |
{ macro_close_explicit, 0 }, /* Ed */ |
{ macro_scoped_explicit, MDOC_EXPLICIT }, /* Bl */ |
{ macro_scoped, MDOC_EXPLICIT }, /* Bl */ |
{ macro_scoped_explicit, 0 }, /* El */ |
{ macro_close_explicit, 0 }, /* El */ |
{ NULL, 0 }, /* It */ |
{ macro_scoped, MDOC_NESTED }, /* It */ |
{ macro_text, MDOC_CALLABLE }, /* Ad */ |
{ macro_text, MDOC_CALLABLE }, /* Ad */ |
{ NULL, 0 }, /* An */ |
{ macro_constant, 0 }, /* An */ |
{ macro_text, MDOC_CALLABLE }, /* Ar */ |
{ macro_text, MDOC_CALLABLE }, /* Ar */ |
{ NULL, 0 }, /* Cd */ |
{ macro_constant, MDOC_QUOTABLE }, /* Cd */ |
{ macro_text, MDOC_CALLABLE }, /* Cm */ |
{ macro_text, MDOC_CALLABLE }, /* Cm */ |
{ macro_text, MDOC_CALLABLE }, /* Dv */ |
{ macro_text, MDOC_CALLABLE }, /* Dv */ |
{ macro_text, MDOC_CALLABLE }, /* Er */ |
{ macro_text, MDOC_CALLABLE }, /* Er */ |
{ macro_text, MDOC_CALLABLE }, /* Ev */ |
{ macro_text, MDOC_CALLABLE }, /* Ev */ |
{ NULL, 0 }, /* Ex */ |
{ macro_constant, 0 }, /* Ex */ |
{ macro_text, MDOC_CALLABLE }, /* Fa */ |
{ macro_text, MDOC_CALLABLE | MDOC_QUOTABLE }, /* Fa */ |
{ NULL, 0 }, /* Fd */ |
{ macro_constant, 0 }, /* Fd */ |
{ macro_text, MDOC_CALLABLE }, /* Fl */ |
{ macro_text, MDOC_CALLABLE }, /* Fl */ |
{ NULL, 0 }, /* Fn */ |
{ macro_text, MDOC_CALLABLE | MDOC_QUOTABLE }, /* Fn */ |
{ macro_text, 0 }, /* Ft */ |
{ macro_text, 0 }, /* Ft */ |
{ macro_text, MDOC_CALLABLE }, /* Ic */ |
{ macro_text, MDOC_CALLABLE }, /* Ic */ |
{ NULL, 0 }, /* In */ |
{ macro_constant, 0 }, /* In */ |
{ macro_text, MDOC_CALLABLE }, /* Li */ |
{ macro_text, MDOC_CALLABLE }, /* Li */ |
{ NULL, 0 }, /* Nd */ |
{ macro_constant, 0 }, /* Nd */ |
{ NULL, 0 }, /* Nm */ |
{ macro_text, MDOC_CALLABLE }, /* Nm */ |
{ NULL, 0 }, /* Op */ |
{ macro_scoped_line, MDOC_CALLABLE }, /* Op */ |
{ NULL, 0 }, /* Ot */ |
{ macro_obsolete, 0 }, /* Ot */ |
{ macro_text, MDOC_CALLABLE }, /* Pa */ |
{ macro_text, MDOC_CALLABLE }, /* Pa */ |
{ NULL, 0 }, /* Rv */ |
{ macro_constant, 0 }, /* Rv */ |
{ NULL, 0 }, /* St */ |
{ macro_constant, 0 }, /* St */ |
{ macro_text, MDOC_CALLABLE }, /* Va */ |
{ macro_text, MDOC_CALLABLE }, /* Va */ |
{ macro_text, MDOC_CALLABLE }, /* Vt */ |
{ macro_text, MDOC_CALLABLE }, /* Vt */ |
{ NULL, 0 }, /* Xr */ |
{ macro_text, MDOC_CALLABLE }, /* Xr */ |
{ NULL, 0 }, /* %A */ |
{ macro_constant, MDOC_QUOTABLE }, /* %A */ |
{ NULL, 0 }, /* %B */ |
{ macro_constant, MDOC_QUOTABLE }, /* %B */ |
{ NULL, 0 }, /* %D */ |
{ macro_constant, MDOC_QUOTABLE }, /* %D */ |
{ NULL, 0 }, /* %I */ |
{ macro_constant, MDOC_QUOTABLE }, /* %I */ |
{ NULL, 0 }, /* %J */ |
{ macro_constant, MDOC_QUOTABLE }, /* %J */ |
{ NULL, 0 }, /* %N */ |
{ macro_constant, MDOC_QUOTABLE }, /* %N */ |
{ NULL, 0 }, /* %O */ |
{ macro_constant, MDOC_QUOTABLE }, /* %O */ |
{ NULL, 0 }, /* %P */ |
{ macro_constant, MDOC_QUOTABLE }, /* %P */ |
{ NULL, 0 }, /* %R */ |
{ macro_constant, MDOC_QUOTABLE }, /* %R */ |
{ NULL, 0 }, /* %T */ |
{ macro_constant, MDOC_QUOTABLE }, /* %T */ |
{ NULL, 0 }, /* %V */ |
{ macro_constant, MDOC_QUOTABLE }, /* %V */ |
{ NULL, 0 }, /* Ac */ |
{ macro_close_explicit, MDOC_CALLABLE }, /* Ac */ |
{ NULL, 0 }, /* Ao */ |
{ macro_constant_scoped, MDOC_CALLABLE }, /* Ao */ |
{ NULL, 0 }, /* Aq */ |
{ macro_scoped_line, MDOC_CALLABLE }, /* Aq */ |
{ NULL, 0 }, /* At */ |
{ macro_constant, 0 }, /* At */ |
{ NULL, 0 }, /* Bc */ |
{ macro_close_explicit, MDOC_CALLABLE }, /* Bc */ |
{ NULL, 0 }, /* Bf */ |
{ macro_scoped, MDOC_EXPLICIT }, /* Bf */ |
{ NULL, 0 }, /* Bo */ |
{ macro_constant_scoped, MDOC_CALLABLE }, /* Bo */ |
{ NULL, 0 }, /* Bq */ |
{ macro_scoped_line, MDOC_CALLABLE }, /* Bq */ |
{ NULL, 0 }, /* Bsx */ |
{ macro_constant_delimited, 0 }, /* Bsx */ |
{ NULL, 0 }, /* Bx */ |
{ macro_constant_delimited, 0 }, /* Bx */ |
{ NULL, 0 }, /* Db */ |
{ macro_constant, 0 }, /* Db */ |
{ NULL, 0 }, /* Dc */ |
{ macro_close_explicit, MDOC_CALLABLE }, /* Dc */ |
{ NULL, 0 }, /* Do */ |
{ macro_constant_scoped, MDOC_CALLABLE }, /* Do */ |
{ NULL, 0 }, /* Dq */ |
{ macro_scoped_line, MDOC_CALLABLE }, /* Dq */ |
{ NULL, 0 }, /* Ec */ |
{ macro_close_explicit, MDOC_CALLABLE }, /* Ec */ |
{ NULL, 0 }, /* Ef */ |
{ macro_close_explicit, 0 }, /* Ef */ |
{ macro_text, MDOC_CALLABLE }, /* Em */ |
{ macro_text, MDOC_CALLABLE }, /* Em */ |
{ NULL, 0 }, /* Eo */ |
{ macro_constant_scoped, MDOC_CALLABLE }, /* Eo */ |
{ NULL, 0 }, /* Fx */ |
{ macro_constant_delimited, 0 }, /* Fx */ |
{ macro_text, 0 }, /* Ms */ |
{ macro_text, 0 }, /* Ms */ |
{ NULL, 0 }, /* No */ |
{ macro_constant_delimited, MDOC_CALLABLE }, /* No */ |
{ NULL, 0 }, /* Ns */ |
{ macro_constant_delimited, MDOC_CALLABLE }, /* Ns */ |
{ NULL, 0 }, /* Nx */ |
{ macro_constant_delimited, 0 }, /* Nx */ |
{ NULL, 0 }, /* Ox */ |
{ macro_constant_delimited, 0 }, /* Ox */ |
{ NULL, 0 }, /* Pc */ |
{ macro_close_explicit, MDOC_CALLABLE }, /* Pc */ |
{ NULL, 0 }, /* Pf */ |
{ macro_constant, 0 }, /* Pf */ |
{ NULL, 0 }, /* Po */ |
{ macro_constant_scoped, MDOC_CALLABLE }, /* Po */ |
{ NULL, 0 }, /* Pq */ |
{ macro_scoped_line, MDOC_CALLABLE }, /* Pq */ |
{ NULL, 0 }, /* Qc */ |
{ macro_close_explicit, MDOC_CALLABLE }, /* Qc */ |
{ NULL, 0 }, /* Ql */ |
{ macro_scoped_line, MDOC_CALLABLE }, /* Ql */ |
{ NULL, 0 }, /* Qo */ |
{ macro_constant_scoped, MDOC_CALLABLE }, /* Qo */ |
{ NULL, 0 }, /* Qq */ |
{ macro_scoped_line, MDOC_CALLABLE }, /* Qq */ |
{ NULL, 0 }, /* Re */ |
{ macro_close_explicit, 0 }, /* Re */ |
{ NULL, 0 }, /* Rs */ |
{ macro_scoped, MDOC_EXPLICIT }, /* Rs */ |
{ NULL, 0 }, /* Sc */ |
{ macro_close_explicit, MDOC_CALLABLE }, /* Sc */ |
{ NULL, 0 }, /* So */ |
{ macro_constant_scoped, MDOC_CALLABLE }, /* So */ |
{ NULL, 0 }, /* Sq */ |
{ macro_scoped_line, MDOC_CALLABLE }, /* Sq */ |
{ NULL, 0 }, /* Sm */ |
{ macro_constant, 0 }, /* Sm */ |
{ NULL, 0 }, /* Sx */ |
{ macro_text, MDOC_CALLABLE }, /* Sx */ |
{ NULL, 0 }, /* Sy */ |
{ macro_text, MDOC_CALLABLE }, /* Sy */ |
{ macro_text, MDOC_CALLABLE }, /* Tn */ |
{ macro_text, MDOC_CALLABLE }, /* Tn */ |
{ NULL, 0 }, /* Ux */ |
{ macro_constant_delimited, 0 }, /* Ux */ |
{ NULL, 0 }, /* Xc */ |
{ macro_close_explicit, MDOC_CALLABLE }, /* Xc */ |
{ NULL, 0 }, /* Xo */ |
{ macro_constant_scoped, MDOC_CALLABLE }, /* Xo */ |
{ NULL, 0 }, /* Fo */ |
{ macro_scoped, MDOC_EXPLICIT }, /* Fo */ /* XXX - supposed to be (but isn't) callable. */ |
{ NULL, 0 }, /* Fc */ |
{ macro_close_explicit, 0 }, /* Fc */ /* XXX - supposed to be (but isn't) callable. */ |
{ NULL, 0 }, /* Oo */ |
{ macro_constant_scoped, MDOC_CALLABLE }, /* Oo */ |
{ NULL, 0 }, /* Oc */ |
{ macro_close_explicit, MDOC_CALLABLE }, /* Oc */ |
{ NULL, 0 }, /* Bk */ |
{ macro_scoped, MDOC_EXPLICIT }, /* Bk */ |
{ NULL, 0 }, /* Ek */ |
{ macro_close_explicit, 0 }, /* Ek */ |
{ NULL, 0 }, /* Bt */ |
{ macro_constant, 0 }, /* Bt */ |
{ NULL, 0 }, /* Hf */ |
{ macro_constant, 0 }, /* Hf */ |
{ NULL, 0 }, /* Fr */ |
{ macro_obsolete, 0 }, /* Fr */ |
{ NULL, 0 }, /* Ud */ |
{ macro_constant, 0 }, /* Ud */ |
}; |
}; |
|
|
const char * const *mdoc_macronames = __mdoc_macronames; |
const char * const *mdoc_macronames = __mdoc_macronames; |
Line 200 static struct mdoc_arg *argdup(size_t, const struct m |
|
Line 201 static struct mdoc_arg *argdup(size_t, const struct m |
|
static void argfree(size_t, struct mdoc_arg *); |
static void argfree(size_t, struct mdoc_arg *); |
static void argcpy(struct mdoc_arg *, |
static void argcpy(struct mdoc_arg *, |
const struct mdoc_arg *); |
const struct mdoc_arg *); |
static char **paramdup(size_t, const char **); |
|
static void paramfree(size_t, char **); |
|
|
|
static void mdoc_node_freelist(struct mdoc_node *); |
static void mdoc_node_freelist(struct mdoc_node *); |
static void mdoc_node_append(struct mdoc *, int, |
static void mdoc_node_append(struct mdoc *, int, |
Line 253 mdoc_parseln(struct mdoc *mdoc, char *buf) |
|
Line 252 mdoc_parseln(struct mdoc *mdoc, char *buf) |
|
char tmp[5]; |
char tmp[5]; |
|
|
if ('.' != *buf) { |
if ('.' != *buf) { |
|
if (SEC_PROLOGUE == mdoc->sec_lastn) |
|
return(mdoc_err(mdoc, -1, 0, ERR_SYNTAX_NOTEXT)); |
mdoc_word_alloc(mdoc, 0, buf); |
mdoc_word_alloc(mdoc, 0, buf); |
|
mdoc->next = MDOC_NEXT_SIBLING; |
return(1); |
return(1); |
} |
} |
|
|
|
|
mdoc_macro(struct mdoc *mdoc, int tok, int ppos, int *pos, char *buf) |
mdoc_macro(struct mdoc *mdoc, int tok, int ppos, int *pos, char *buf) |
{ |
{ |
|
|
|
if ( ! (MDOC_PROLOGUE & mdoc_macros[tok].flags) && |
|
SEC_PROLOGUE == mdoc->sec_lastn) |
|
return(mdoc_err(mdoc, tok, ppos, ERR_SEC_PROLOGUE)); |
|
|
if (NULL == (mdoc_macros[tok].fp)) { |
if (NULL == (mdoc_macros[tok].fp)) { |
(void)mdoc_err(mdoc, tok, ppos, ERR_MACRO_NOTSUP); |
(void)mdoc_err(mdoc, tok, ppos, ERR_MACRO_NOTSUP); |
return(0); |
return(0); |
Line 362 mdoc_node_append(struct mdoc *mdoc, int pos, struct md |
|
Line 368 mdoc_node_append(struct mdoc *mdoc, int pos, struct md |
|
nn = mdoc_macronames[p->data.head.tok]; |
nn = mdoc_macronames[p->data.head.tok]; |
nt = "head"; |
nt = "head"; |
break; |
break; |
|
case (MDOC_TAIL): |
|
nn = mdoc_macronames[p->data.tail.tok]; |
|
nt = "tail"; |
|
break; |
case (MDOC_BLOCK): |
case (MDOC_BLOCK): |
nn = mdoc_macronames[p->data.block.tok]; |
nn = mdoc_macronames[p->data.block.tok]; |
nt = "block"; |
nt = "block"; |
Line 396 mdoc_node_append(struct mdoc *mdoc, int pos, struct md |
|
Line 406 mdoc_node_append(struct mdoc *mdoc, int pos, struct md |
|
on = mdoc_macronames[mdoc->last->data.head.tok]; |
on = mdoc_macronames[mdoc->last->data.head.tok]; |
ot = "head"; |
ot = "head"; |
break; |
break; |
|
case (MDOC_TAIL): |
|
on = mdoc_macronames[mdoc->last->data.tail.tok]; |
|
ot = "tail"; |
|
break; |
case (MDOC_BLOCK): |
case (MDOC_BLOCK): |
on = mdoc_macronames[mdoc->last->data.block.tok]; |
on = mdoc_macronames[mdoc->last->data.block.tok]; |
ot = "block"; |
ot = "block"; |
Line 405 mdoc_node_append(struct mdoc *mdoc, int pos, struct md |
|
Line 419 mdoc_node_append(struct mdoc *mdoc, int pos, struct md |
|
/* NOTREACHED */ |
/* NOTREACHED */ |
} |
} |
|
|
switch (p->type) { |
switch (mdoc->next) { |
case (MDOC_BODY): |
case (MDOC_NEXT_SIBLING): |
switch (mdoc->last->type) { |
mdoc->last->next = p; |
case (MDOC_BLOCK): |
p->prev = mdoc->last; |
p->parent = mdoc->last; |
p->parent = mdoc->last->parent; |
mdoc->last->child = p; |
act = "sibling"; |
act = "child"; |
|
break; |
|
case (MDOC_HEAD): |
|
p->parent = mdoc->last->parent; |
|
mdoc->last->next = p; |
|
p->prev = mdoc->last; |
|
act = "sibling"; |
|
break; |
|
default: |
|
abort(); |
|
/* NOTREACHED */ |
|
} |
|
break; |
break; |
case (MDOC_HEAD): |
case (MDOC_NEXT_CHILD): |
assert(mdoc->last->type == MDOC_BLOCK); |
|
p->parent = mdoc->last; |
|
mdoc->last->child = p; |
mdoc->last->child = p; |
|
p->parent = mdoc->last; |
act = "child"; |
act = "child"; |
break; |
break; |
default: |
default: |
switch (mdoc->last->type) { |
abort(); |
case (MDOC_BODY): |
/* NOTREACHED */ |
/* FALLTHROUGH */ |
|
case (MDOC_HEAD): |
|
p->parent = mdoc->last->parent; |
|
mdoc->last->child = p; |
|
act = "child"; |
|
break; |
|
default: |
|
p->parent = mdoc->last->parent; |
|
p->prev = mdoc->last; |
|
mdoc->last->next = p; |
|
act = "sibling"; |
|
break; |
|
} |
|
break; |
|
} |
} |
|
|
mdoc_msg(mdoc, pos, "parse: %s `%s' %s %s `%s'", |
mdoc_msg(mdoc, pos, "parse: %s `%s' %s of %s `%s'", |
nt, nn, act, ot, on); |
nt, nn, act, ot, on); |
|
|
mdoc->last = p; |
mdoc->last = p; |
} |
} |
|
|
|
|
void |
void |
mdoc_head_alloc(struct mdoc *mdoc, int pos, int tok, |
mdoc_tail_alloc(struct mdoc *mdoc, int pos, int tok) |
size_t paramsz, const char **params) |
|
{ |
{ |
struct mdoc_node *p; |
struct mdoc_node *p; |
|
|
assert(mdoc->first); |
assert(mdoc->first); |
assert(mdoc->last); |
assert(mdoc->last); |
assert(mdoc->last->type == MDOC_BLOCK); |
|
assert(mdoc->last->data.block.tok == tok); |
|
|
|
p = xcalloc(1, sizeof(struct mdoc_node)); |
p = xcalloc(1, sizeof(struct mdoc_node)); |
|
|
|
p->type = MDOC_TAIL; |
|
p->data.tail.tok = tok; |
|
|
|
mdoc_node_append(mdoc, pos, p); |
|
} |
|
|
|
|
|
void |
|
mdoc_head_alloc(struct mdoc *mdoc, int pos, int tok) |
|
{ |
|
struct mdoc_node *p; |
|
|
|
assert(mdoc->first); |
|
assert(mdoc->last); |
|
|
|
p = xcalloc(1, sizeof(struct mdoc_node)); |
|
|
p->type = MDOC_HEAD; |
p->type = MDOC_HEAD; |
p->data.head.tok = tok; |
p->data.head.tok = tok; |
p->data.head.sz = paramsz; |
|
p->data.head.args = paramdup(paramsz, params); |
|
|
|
mdoc_node_append(mdoc, pos, p); |
mdoc_node_append(mdoc, pos, p); |
} |
} |
Line 483 mdoc_body_alloc(struct mdoc *mdoc, int pos, int tok) |
|
Line 484 mdoc_body_alloc(struct mdoc *mdoc, int pos, int tok) |
|
|
|
assert(mdoc->first); |
assert(mdoc->first); |
assert(mdoc->last); |
assert(mdoc->last); |
assert((mdoc->last->type == MDOC_BLOCK) || |
|
(mdoc->last->type == MDOC_HEAD)); |
|
if (mdoc->last->type == MDOC_BLOCK) |
|
assert(mdoc->last->data.block.tok == tok); |
|
else |
|
assert(mdoc->last->data.head.tok == tok); |
|
|
|
p = xcalloc(1, sizeof(struct mdoc_node)); |
p = xcalloc(1, sizeof(struct mdoc_node)); |
|
|
Line 518 mdoc_block_alloc(struct mdoc *mdoc, int pos, int tok, |
|
Line 513 mdoc_block_alloc(struct mdoc *mdoc, int pos, int tok, |
|
|
|
void |
void |
mdoc_elem_alloc(struct mdoc *mdoc, int pos, int tok, |
mdoc_elem_alloc(struct mdoc *mdoc, int pos, int tok, |
size_t argsz, const struct mdoc_arg *args, |
size_t argsz, const struct mdoc_arg *args) |
size_t paramsz, const char **params) |
|
{ |
{ |
struct mdoc_node *p; |
struct mdoc_node *p; |
|
|
p = xcalloc(1, sizeof(struct mdoc_node)); |
p = xcalloc(1, sizeof(struct mdoc_node)); |
p->type = MDOC_ELEM; |
p->type = MDOC_ELEM; |
p->data.elem.tok = tok; |
p->data.elem.tok = tok; |
p->data.elem.sz = paramsz; |
|
p->data.elem.args = paramdup(paramsz, params); |
|
p->data.elem.argc = argsz; |
p->data.elem.argc = argsz; |
p->data.elem.argv = argdup(argsz, args); |
p->data.elem.argv = argdup(argsz, args); |
|
|
|
|
mdoc_elem_free(struct mdoc_elem *p) |
mdoc_elem_free(struct mdoc_elem *p) |
{ |
{ |
|
|
paramfree(p->sz, p->args); |
|
argfree(p->argc, p->argv); |
argfree(p->argc, p->argv); |
} |
} |
|
|
Line 595 mdoc_text_free(struct mdoc_text *p) |
|
Line 586 mdoc_text_free(struct mdoc_text *p) |
|
} |
} |
|
|
|
|
static void |
|
mdoc_head_free(struct mdoc_head *p) |
|
{ |
|
|
|
paramfree(p->sz, p->args); |
|
} |
|
|
|
|
|
void |
void |
mdoc_node_free(struct mdoc_node *p) |
mdoc_node_free(struct mdoc_node *p) |
{ |
{ |
Line 617 mdoc_node_free(struct mdoc_node *p) |
|
Line 600 mdoc_node_free(struct mdoc_node *p) |
|
case (MDOC_BLOCK): |
case (MDOC_BLOCK): |
mdoc_block_free(&p->data.block); |
mdoc_block_free(&p->data.block); |
break; |
break; |
case (MDOC_HEAD): |
|
mdoc_head_free(&p->data.head); |
|
break; |
|
default: |
default: |
break; |
break; |
} |
} |
Line 679 argdup(size_t argsz, const struct mdoc_arg *args) |
|
Line 659 argdup(size_t argsz, const struct mdoc_arg *args) |
|
return(pp); |
return(pp); |
} |
} |
|
|
|
|
static void |
|
paramfree(size_t sz, char **p) |
|
{ |
|
int i; |
|
|
|
if (0 == sz) |
|
return; |
|
|
|
assert(p); |
|
/* LINTED */ |
|
for (i = 0; i < (int)sz; i++) |
|
free(p[i]); |
|
free(p); |
|
} |
|
|
|
|
|
static char ** |
|
paramdup(size_t sz, const char **p) |
|
{ |
|
char **pp; |
|
int i; |
|
|
|
if (0 == sz) |
|
return(NULL); |
|
|
|
pp = xcalloc(sz, sizeof(char *)); |
|
for (i = 0; i < (int)sz; i++) |
|
pp[i] = xstrdup(p[i]); |
|
|
|
return(pp); |
|
} |
|