Skip to content

Commit

Permalink
Avoid calling hv_iterkeysv more than once
Browse files Browse the repository at this point in the history
SvPVutf8 is a macro...
  • Loading branch information
johannessen committed Feb 22, 2021
1 parent 915a86a commit 122a31b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/Neo4j/Bolt/CTypeHandlers.xs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 122a31b

Please sign in to comment.