Remove quotes around string when converting string object to cstring
@@ -617,8 +617,9 @@ char *objectToString(Value value) {
case OBJ_STRING: {
ObjString *stringObj = AS_STRING(value);
- char *string = malloc(sizeof(char) * stringObj->length + 3);
- snprintf(string, stringObj->length + 3, "'%s'", stringObj->chars);
+ char *string = malloc(sizeof(char) * stringObj->length + 1);
+ memcpy(string, stringObj->chars, stringObj->length);
+ string[stringObj->length] = '\0';
return string;
}
