commit 5854dd185ba998944fdac5e902cc67ecc8f06074
parent 6601804250c2d0d65e8cf9803fa0bbce48887a1d
Author: Kyle Milz <krwmilz@gmail.com>
Date: Sat, 11 Mar 2023 23:55:01 +0000
move last_page_offset into local scope
Diffstat:
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/dvi-init.c b/dvi-init.c
@@ -60,11 +60,6 @@ static Boolean dvi_is_valid = False; /* if not initializing */
static long numerator, denominator;
static unsigned int dvi_unshrunk_page_w, dvi_unshrunk_page_h;
-/*
- * Offset in DVI file of last page, set in read_postamble().
- */
-static long last_page_offset;
-
/*
* free_vf_chain frees the vf_chain structure.
@@ -556,7 +551,7 @@ find_postamble(void)
* used in the job.
*/
static Boolean
-read_postamble(void)
+read_postamble(long *last_page_offset)
{
unsigned char cmnd;
struct font *fontp;
@@ -565,7 +560,7 @@ read_postamble(void)
if (one(dvi_file) != POST)
/* Postamble doesn't begin with POST */
return False;
- last_page_offset = four(dvi_file);
+ *last_page_offset = four(dvi_file);
if (numerator != four(dvi_file) || denominator != four(dvi_file) ||
magnification != four(dvi_file))
/* Postamble doesn't match preamble */
@@ -675,7 +670,7 @@ read_postamble(void)
}
static void
-prepare_pages(void)
+prepare_pages(long last_page_offset)
{
int i;
@@ -760,14 +755,16 @@ set_titles(void)
Boolean
init_dvi_file(void)
{
+ long last_page_offset;
+
if (!process_preamble())
goto err;
if (!find_postamble())
goto err;
- if (!read_postamble())
+ if (!read_postamble(&last_page_offset))
goto err;
- prepare_pages();
+ prepare_pages(last_page_offset);
if (current_page >= total_pages)
current_page = total_pages - 1;
init_prescan();