source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mandoc: streamline termp allocation: this will allow the init function
@ 2017-11-10 23:43 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2017-11-10 23:43 UTC (permalink / raw)
  To: source

Log Message:
-----------
streamline termp allocation: this will allow the init function
to do things differently in the ps vs pdf case;
from espie@

Modified Files:
--------------
    mandoc:
        term_ps.c

Revision Data
-------------
Index: term_ps.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/term_ps.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -Lterm_ps.c -Lterm_ps.c -u -p -r1.90 -r1.91
--- term_ps.c
+++ term_ps.c
@@ -111,7 +111,7 @@ static	void		  ps_printf(struct termp *,
 static	void		  ps_putchar(struct termp *, char);
 static	void		  ps_setfont(struct termp *, enum termfont);
 static	void		  ps_setwidth(struct termp *, int, int);
-static	struct termp	 *pspdf_alloc(const struct manoutput *);
+static	struct termp	 *pspdf_alloc(const struct manoutput *, enum termtype);
 static	void		  pdf_obj(struct termp *, size_t);
 
 /*
@@ -514,27 +514,17 @@ static	const struct font fonts[TERMFONT_
 void *
 pdf_alloc(const struct manoutput *outopts)
 {
-	struct termp	*p;
-
-	if (NULL != (p = pspdf_alloc(outopts)))
-		p->type = TERMTYPE_PDF;
-
-	return p;
+	return pspdf_alloc(outopts, TERMTYPE_PDF);
 }
 
 void *
 ps_alloc(const struct manoutput *outopts)
 {
-	struct termp	*p;
-
-	if (NULL != (p = pspdf_alloc(outopts)))
-		p->type = TERMTYPE_PS;
-
-	return p;
+	return pspdf_alloc(outopts, TERMTYPE_PS);
 }
 
 static struct termp *
-pspdf_alloc(const struct manoutput *outopts)
+pspdf_alloc(const struct manoutput *outopts, enum termtype type)
 {
 	struct termp	*p;
 	unsigned int	 pagex, pagey;
@@ -544,6 +534,7 @@ pspdf_alloc(const struct manoutput *outo
 	p = mandoc_calloc(1, sizeof(*p));
 	p->tcol = p->tcols = mandoc_calloc(1, sizeof(*p->tcol));
 	p->maxtcol = 1;
+	p->type = type;
 
 	p->enc = TERMENC_ASCII;
 	p->fontq = mandoc_reallocarray(NULL,
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-11-10 23:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-10 23:43 mandoc: streamline termp allocation: this will allow the init function schwarze

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).