aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
Diffstat (limited to 'erts/emulator/beam')
-rwxr-xr-xerts/emulator/beam/erl_bif_info.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/erts/emulator/beam/erl_bif_info.c b/erts/emulator/beam/erl_bif_info.c
index a43eee6420..673dfc658c 100755
--- a/erts/emulator/beam/erl_bif_info.c
+++ b/erts/emulator/beam/erl_bif_info.c
@@ -2612,24 +2612,29 @@ BIF_RETTYPE system_info_1(BIF_ALIST_1)
}
#endif
else if (ERTS_IS_ATOM_STR("compile_info",BIF_ARG_1)) {
- Eterm *hp = HAlloc(BIF_P, 3*3+3*2); /* three two tuples +
- three list elems */
- Eterm res = NIL;
- Eterm *lhp = HAlloc(BIF_P, 2*(strlen(erts_build_flags_CONFIG_H)+
- strlen(erts_build_flags_CFLAGS)+
- strlen(erts_build_flags_LDFLAGS)));
-
- res = CONS(hp+9,TUPLE2(hp, am_config_h,
- buf_to_intlist(&lhp, erts_build_flags_CONFIG_H,
- strlen(erts_build_flags_CONFIG_H), NIL)),res);
- res = CONS(hp+11,TUPLE2(hp+3, am_cflags,
- buf_to_intlist(&lhp, erts_build_flags_CFLAGS,
- strlen(erts_build_flags_CFLAGS), NIL)),res);
- res = CONS(hp+13,TUPLE2(hp+6, am_ldflags,
- buf_to_intlist(&lhp, erts_build_flags_LDFLAGS,
- strlen(erts_build_flags_LDFLAGS), NIL)),res);
-
- BIF_RET(res);
+ Uint sz;
+ Eterm res = NIL, tup, text;
+ Eterm *hp = HAlloc(BIF_P, 3*(2 + 3) + /* three 2-tuples and three cons */
+ 2*(strlen(erts_build_flags_CONFIG_H) +
+ strlen(erts_build_flags_CFLAGS) +
+ strlen(erts_build_flags_LDFLAGS)));
+
+ sz = strlen(erts_build_flags_CONFIG_H);
+ text = buf_to_intlist(&hp, erts_build_flags_CONFIG_H, sz, NIL);
+ tup = TUPLE2(hp, am_config_h, text); hp += 3;
+ res = CONS(hp, tup, res); hp += 2;
+
+ sz = strlen(erts_build_flags_CFLAGS);
+ text = buf_to_intlist(&hp, erts_build_flags_CFLAGS, sz, NIL);
+ tup = TUPLE2(hp, am_cflags, text); hp += 3;
+ res = CONS(hp, tup, res); hp += 2;
+
+ sz = strlen(erts_build_flags_LDFLAGS);
+ text = buf_to_intlist(&hp, erts_build_flags_LDFLAGS, sz, NIL);
+ tup = TUPLE2(hp, am_ldflags, text); hp += 3;
+ res = CONS(hp, tup, res); hp += 2;
+
+ BIF_RET(res);
}
BIF_ERROR(BIF_P, BADARG);