Added handling of strings in STR() too

This commit is contained in:
Johnny 2021-03-08 17:55:48 +01:00 committed by GitHub
parent 5de031245d
commit 255eb52602
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17768,6 +17768,13 @@ static int _std_str(mb_interpreter_t* s, void** l) {
mb_realtostr(arg.value.float_point, _CHAR_BUF_PTR(buf), lbuf);
#endif /* MB_MANUAL_REAL_FORMATTING */
break;
case MB_DT_STRING:
lbuf = strlen(arg.value.string) + 1; /* Buffer needs to be as big as the string */
_RESIZE_CHAR_BUF(buf, lbuf);
char* str = mb_memdup(arg.value.string, lbuf); /* Create a copy of the string */
_CHAR_BUF_PTR(buf) = str;
break;
case MB_DT_TYPE: {
const char* sp = mb_get_type_string(arg.value.type);