summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJustus Winter <justus@g10code.com>2017-02-28 16:19:18 +0100
committerJustus Winter <justus@g10code.com>2017-02-28 16:19:18 +0100
commite4583ae14e52482ab390c102d071755f91ab211d (patch)
tree30f28c89237eee0e13ea8425fd696613b9f68259 /tests
parentgpgscm: Fix calculating the line number. (diff)
downloadgnupg2-e4583ae14e52482ab390c102d071755f91ab211d.tar.xz
gnupg2-e4583ae14e52482ab390c102d071755f91ab211d.zip
gpgscm: Improve parsing.
* tests/gpgscm/scheme.c (port_increment_current_line): Avoid creating the same integer if the delta is zero. This happens a lot during parsing, and puts pressure on the memory allocator. Signed-off-by: Justus Winter <justus@g10code.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/gpgscm/scheme.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c
index 0453754a6..b2ff72145 100644
--- a/tests/gpgscm/scheme.c
+++ b/tests/gpgscm/scheme.c
@@ -1735,6 +1735,9 @@ port_clear_location (scheme *sc, port *p)
static void
port_increment_current_line (scheme *sc, port *p, long delta)
{
+ if (delta == 0)
+ return;
+
p->curr_line =
mk_integer(sc, ivalue_unchecked(p->curr_line) + delta);
}