Skip to content

Commit ded6469

Browse files
committed
Simplified conndefaults stub
1 parent 253c93d commit ded6469

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

lib/postgresql_stubs.c

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -310,29 +310,17 @@ CAMLprim value PQconndefaults_stub(value __unused v_unit)
310310
v_res = caml_alloc_tuple(n);
311311

312312
for (i = 0; i < n; i++, p++) {
313-
value v_field;
314313
v_el = caml_alloc_small(7, 0);
315314
for (j = 0; j < 7; j++) Field(v_el, j) = v_None;
316315
Store_field(v_res, i, v_el);
317-
v_field = caml_copy_string(p->keyword);
318-
Store_field(v_el, 0, v_field);
319-
if (p->envvar) {
320-
v_field = make_some(caml_copy_string(p->envvar));
321-
caml_modify(&Field(v_el, 1), v_field);
322-
}
323-
if (p->compiled) {
324-
v_field = make_some(caml_copy_string(p->compiled));
325-
caml_modify(&Field(v_el, 2), v_field);
326-
};
327-
if (p->val) {
328-
v_field = make_some(caml_copy_string(p->val));
329-
caml_modify(&Field(v_el, 3), v_field);
330-
};
331-
v_field = caml_copy_string(p->label);
332-
caml_modify(&Field(v_el, 4), v_field);
333-
v_field = caml_copy_string(p->dispchar);
334-
caml_modify(&Field(v_el, 5), v_field);
335-
caml_modify(&Field(v_el, 6), Val_int(p->dispsize));
316+
Store_field(v_el, 0, caml_copy_string(p->keyword));
317+
if (p->envvar) Store_field(v_el, 1, make_some(caml_copy_string(p->envvar)));
318+
if (p->compiled)
319+
Store_field(v_el, 2, make_some(caml_copy_string(p->compiled)));
320+
if (p->val) Store_field(v_el, 3, make_some(caml_copy_string(p->val)));
321+
Store_field(v_el, 4, caml_copy_string(p->label));
322+
Store_field(v_el, 5, caml_copy_string(p->dispchar));
323+
Store_field(v_el, 6, Val_int(p->dispsize));
336324
};
337325

338326
PQconninfoFree(cios);

0 commit comments

Comments
 (0)