Skip to content

Commit d4a4c3d

Browse files
committed
Suppress compiler warning in new jsonb_plperl code.
Some compilers are evidently pickier than others about whether Perl's I32 typedef should be considered equivalent to int. Dodge the problem by using a separate variable; the prior coding was a bit confusing anyway. Per buildfarm. Note this does nothing to fix the test failures due to SV_to_JsonbValue not covering enough variable types.
1 parent 242408d commit d4a4c3d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

contrib/jsonb_plperl/jsonb_plperl.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,19 @@ HV_to_JsonbValue(HV *obj, JsonbParseState **jsonb_state)
150150
dTHX;
151151
JsonbValue key;
152152
SV *val;
153+
char *kstr;
154+
I32 klen;
153155

154156
key.type = jbvString;
155157

156158
pushJsonbValue(jsonb_state, WJB_BEGIN_OBJECT, NULL);
157159

158160
(void) hv_iterinit(obj);
159161

160-
while ((val = hv_iternextsv(obj, &key.val.string.val, &key.val.string.len)))
162+
while ((val = hv_iternextsv(obj, &kstr, &klen)))
161163
{
162-
key.val.string.val = pnstrdup(key.val.string.val, key.val.string.len);
164+
key.val.string.val = pnstrdup(kstr, klen);
165+
key.val.string.len = klen;
163166
pushJsonbValue(jsonb_state, WJB_KEY, &key);
164167
(void) SV_to_JsonbValue(val, jsonb_state, false);
165168
}

0 commit comments

Comments
 (0)