summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2021-03-30 10:59:39 +0200
committerThomas Deutschmann <whissi@gentoo.org>2021-04-01 00:04:14 +0200
commit5ff1d6955496b3cf9a35042c9ac35db43bc336b1 (patch)
tree6d470f7eb448f59f53e8df1010aec9dad8ce1f72 /base/gdevmrun.c
parentImport Ghostscript 9.53.1 (diff)
downloadghostscript-gpl-patches-5ff1d6955496b3cf9a35042c9ac35db43bc336b1.tar.gz
ghostscript-gpl-patches-5ff1d6955496b3cf9a35042c9ac35db43bc336b1.tar.bz2
ghostscript-gpl-patches-5ff1d6955496b3cf9a35042c9ac35db43bc336b1.zip
Import Ghostscript 9.54ghostscript-9.54
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'base/gdevmrun.c')
-rw-r--r--base/gdevmrun.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/base/gdevmrun.c b/base/gdevmrun.c
index df1667e2..fa16ffbc 100644
--- a/base/gdevmrun.c
+++ b/base/gdevmrun.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2020 Artifex Software, Inc.
+/* Copyright (C) 2001-2021 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
@@ -117,14 +117,12 @@ rp_delete_next(run_ptr *prpc, run *data, run_line *line)
RP_PREV(rpn) = 0;
line->free = rpn.index;
}
-static int
-rp_insert_next(run_ptr *prpc, run *data, run_line *line, run_ptr *prpn)
+static void
+rp_insert_next_cant_fail(run_ptr *prpc, run *data, run_line *line, run_ptr *prpn)
{
run_index new = line->free;
run *prnew = data + new;
- if (new == 0)
- return -1;
RP_TO_NEXT(*prpc, data, *prpn);
RP_NEXT(*prpc) = new;
RP_PREV(*prpn) = new;
@@ -133,6 +131,13 @@ rp_insert_next(run_ptr *prpc, run *data, run_line *line, run_ptr *prpn)
prnew->next = prpn->index;
prpn->index = new;
prpn->ptr = prnew;
+}
+static int
+rp_insert_next(run_ptr *prpc, run *data, run_line *line, run_ptr *prpn)
+{
+ if (line->free == 0)
+ return -1;
+ rp_insert_next_cant_fail(prpc, data, line, prpn);
return 0;
}
static int
@@ -524,6 +529,7 @@ run_fill_interval(run_line *line, int xo, int xe, run_value new)
)
RP_LENGTH(rp0) += left;
else {
+ run_ptr rpn = {0};
/*
* If we need more than one run, we divide up the length to
* create more runs with length less than MAX_RUN_LENGTH in
@@ -542,14 +548,13 @@ run_fill_interval(run_line *line, int xo, int xe, run_value new)
len = (left + pieces - 1) / pieces;
}
do {
- run_ptr rpn;
/*
* The allocation in rp_insert_next can't fail, because
* we just deleted at least as many runs as we're going
* to insert.
*/
- rp_insert_next(&rp0, data, line, &rpn);
+ rp_insert_next_cant_fail(&rp0, data, line, &rpn);
RP_LENGTH(rpn) = min(left, len);
RP_VALUE(rpn) = new;
}