Просмотр исходного кода

device: use CE_{NEW,DELETE}() to allocate Device

Daniele Bartolini 2 лет назад
Родитель
Сommit
ffdd9c2d8c
1 измененных файлов с 2 добавлено и 3 удалено
  1. 2 3
      src/device/device.cpp

+ 2 - 3
src/device/device.cpp

@@ -780,16 +780,15 @@ void Device::refresh(const char *json)
 #endif // if CROWN_DEBUG
 }
 
-char _buffer[sizeof(Device)];
 Device *_device = NULL;
 
 void run(const DeviceOptions &opts)
 {
 	CE_ASSERT(_device == NULL, "Crown already initialized");
 	console_server_globals::init();
-	_device = new (_buffer) Device(opts, *console_server());
+	_device = CE_NEW(default_allocator(), Device)(opts, *console_server());
 	_device->run();
-	_device->~Device();
+	CE_DELETE(default_allocator(), _device);
 	_device = NULL;
 	console_server_globals::shutdown();
 }