Use AutoGCRoot in native Bytes type

This commit is contained in:
Joshua Granick
2016-08-30 15:08:05 -07:00
parent 1e57e45886
commit 4633398244
3 changed files with 12 additions and 11 deletions

View File

@@ -29,7 +29,7 @@ namespace lime {
unsigned char *_data; unsigned char *_data;
int _length; int _length;
value *_root; AutoGCRoot *_root;
value _value; value _value;

View File

@@ -216,6 +216,8 @@ namespace lime {
value lime_bytes_read_file (HxString path) { value lime_bytes_read_file (HxString path) {
printf("SLDJFLKDJF\n");
Bytes data = Bytes (path.__s); Bytes data = Bytes (path.__s);
return data.Value (); return data.Value ();

View File

@@ -124,8 +124,7 @@ namespace lime {
if (_root) { if (_root) {
*_root = 0; delete _root;
free_root (_root);
} }
@@ -160,8 +159,7 @@ namespace lime {
if (!_value) { if (!_value) {
_value = alloc_empty_object (); _value = alloc_empty_object ();
_root = alloc_root (); _root = new AutoGCRoot (_value);
*_root = _value;
} }
@@ -222,8 +220,7 @@ namespace lime {
if (_root) { if (_root) {
*_root = 0; delete _root;
free_root (_root);
} }
@@ -235,11 +232,14 @@ namespace lime {
if (!_root) { if (!_root) {
_root = alloc_root (); _root = new AutoGCRoot (_value);
} else {
_root->set (_value);
} }
*_root = _value;
_length = val_int (val_field (bytes, id_length)); _length = val_int (val_field (bytes, id_length));
if (_length > 0) { if (_length > 0) {
@@ -283,8 +283,7 @@ namespace lime {
if (_root) { if (_root) {
*_root = 0; delete _root;
free_root (_root);
} }