From 122a31bcc7f11162944738b80d4f480c3c7aee93 Mon Sep 17 00:00:00 2001 From: Arne Johannessen Date: Mon, 22 Feb 2021 15:50:37 +0100 Subject: [PATCH] Avoid calling hv_iterkeysv more than once SvPVutf8 is a macro... --- lib/Neo4j/Bolt/CTypeHandlers.xs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Neo4j/Bolt/CTypeHandlers.xs b/lib/Neo4j/Bolt/CTypeHandlers.xs index eaccace..9d019d6 100644 --- a/lib/Neo4j/Bolt/CTypeHandlers.xs +++ b/lib/Neo4j/Bolt/CTypeHandlers.xs @@ -162,7 +162,7 @@ neo4j_value_t AV_to_neo4j_list(AV *av) { neo4j_value_t HV_to_neo4j_map (HV *hv) { HE *ent; char *k,*k0; - SV *v; + SV *v,*ksv; int n; STRLEN retlen; neo4j_map_entry_t *map_ents; @@ -173,7 +173,8 @@ neo4j_value_t HV_to_neo4j_map (HV *hv) { hv_iterinit(hv); n=0; while ((ent = hv_iternext(hv))) { - k = SvPVutf8(hv_iterkeysv(ent), retlen); + ksv = hv_iterkeysv(ent); + k = SvPVutf8(ksv, retlen); Newx(k0,retlen+1,char); memcpy(k0,k,retlen); *(k0+retlen)=0;