From c4146385dafc580d3e13af099b8426d0bbc5d5ee Mon Sep 17 00:00:00 2001
From: "Sven M. Hallberg" <pesco@khjk.org>
Date: Tue, 28 Jan 2020 14:16:58 +0100
Subject: [PATCH] remove unused "objs" array

---
 pdf.c | 29 -----------------------------
 1 file changed, 29 deletions(-)

diff --git a/pdf.c b/pdf.c
index 32f4974..7a033ca 100644
--- a/pdf.c
+++ b/pdf.c
@@ -110,8 +110,6 @@ struct Env {
 
 	const HParsedToken **xrefs;	/* all xref sections of the file */
 	size_t nxrefs;
-	const HParsedToken **objs;
-	size_t nobjs;
 };
 
 
@@ -1299,31 +1297,6 @@ end:
 	return xrefs;
 }
 
-/* allocate space for the cross-reference table */
-void alloc_xreftable(struct Env *aux)
-{
-	const HParsedToken *v;
-	size_t n;
-
-	if (aux->nxrefs == 0)
-		return;
-
-	v = dictentry(H_INDEX_SEQ(aux->xrefs[0], 1), "Size");
-	if (v == NULL || v->token_type != TT_SINT || v->sint < 0) {
-		fprintf(stderr, "%s: invalid /Size in xref section\n",
-		    aux->infile);
-		return;
-	}
-	n = v->sint;
-
-	if (n > SIZE_MAX / sizeof(HParsedToken *))
-		errx(1, "malloc: size would overflow");
-	aux->objs = malloc(n * sizeof(HParsedToken *));
-	if (aux->objs == NULL)
-		err(1, "malloc");
-	aux->nobjs = n;
-}
-
 int
 main(int argc, char *argv[])
 {
@@ -1362,8 +1335,6 @@ main(int argc, char *argv[])
 	//for (size_t i = 0; i < aux.nxrefs; i++)
 	//	h_pprintln(stderr, aux.xrefs[i]);
 
-	alloc_xreftable(&aux);
-
 	/* run the main parser */
 	res = h_parse(p_pdf, input, sz);
 	if (!res) {
-- 
GitLab