From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id b2601340 for ; Fri, 10 Nov 2017 18:43:23 -0500 (EST) Date: Fri, 10 Nov 2017 18:43:23 -0500 (EST) Message-Id: <120832736040308704.enqueue@fantadrom.bsd.lv> X-Mailinglist: mandoc-source Reply-To: source@mandoc.bsd.lv MIME-Version: 1.0 From: schwarze@mandoc.bsd.lv To: source@mandoc.bsd.lv Subject: mandoc: streamline termp allocation: this will allow the init function X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 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