summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2015-08-29 11:34:09 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2015-08-29 11:34:09 +0000
commit96696348ebb22f703d45f359cb000e006fdd39e4 (patch)
treeb29c16461b9f028fb68ddc17467c81ba203b2c03 /Build
parentf76dd0aaf77593ea3d466b51e96c1b41835006d0 (diff)
luaTeX: minor code improvement
git-svn-id: svn://tug.org/texlive/trunk@38235 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/web2c/luatexdir/image/pdftoepdf.w13
1 files changed, 7 insertions, 6 deletions
diff --git a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w
index 6e214c13cc7..b01a10bb8c1 100644
--- a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w
+++ b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w
@@ -46,15 +46,14 @@ static int CompPdfDocument(const void *pa, const void *pb, void * /*p */ )
// Returns pointer to PdfDocument structure for PDF file.
-static PdfDocument *findPdfDocument(const char *file_path)
+static PdfDocument *findPdfDocument(char *file_path)
{
PdfDocument *pdf_doc, tmp;
assert(file_path != NULL);
if (PdfDocumentTree == NULL)
return NULL;
- tmp.file_path = xstrdup(file_path);
+ tmp.file_path = file_path;
pdf_doc = (PdfDocument *) avl_find(PdfDocumentTree, &tmp);
- free(tmp.file_path);
return pdf_doc;
}
@@ -96,7 +95,7 @@ static char *get_file_checksum(const char *a, file_error_mode fe)
PdfDocument *refPdfDocument(const char *file_path, file_error_mode fe)
{
- char *checksum;
+ char *checksum, *path_copy;
PdfDocument *pdf_doc;
PDFDoc *doc = NULL;
GooString *docName = NULL;
@@ -106,13 +105,14 @@ PdfDocument *refPdfDocument(const char *file_path, file_error_mode fe)
return (PdfDocument *) NULL;
}
assert(checksum != NULL);
- if ((pdf_doc = findPdfDocument(file_path)) == NULL) {
+ path_copy = xstrdup(file_path);
+ if ((pdf_doc = findPdfDocument(path_copy)) == NULL) {
#ifdef DEBUG
fprintf(stderr, "\nDEBUG: New PdfDocument %s\n", file_path);
#endif
new_flag = 1;
pdf_doc = new PdfDocument;
- pdf_doc->file_path = xstrdup(file_path);
+ pdf_doc->file_path = path_copy;
pdf_doc->checksum = checksum;
pdf_doc->doc = NULL;
pdf_doc->inObjList = NULL;
@@ -129,6 +129,7 @@ PdfDocument *refPdfDocument(const char *file_path, file_error_mode fe)
luatex_fail("PDF inclusion: file has changed '%s'", file_path);
}
free(checksum);
+ free(path_copy);
}
assert(pdf_doc != NULL);
if (pdf_doc->doc == NULL) {