[FL-2274] Inventing streams and moving FFF to them (#981)
* Streams: string stream * String stream: updated insert/delete api * Streams: generic stream interface and string stream implementation * Streams: helpers for insert and delete_and_insert * FFF: now compatible with streams * MinUnit: introduced tests with arguments * FFF: stream access violation * Streams: copy data between streams * Streams: file stream * FFF: documentation * FFStream: documentation * FFF: alloc as file * MinUnit: support for nested tests * Streams: changed delete_and_insert, now it returns success flag. Added ability dump stream inner parameters and data to cout. * FFF: simplified file open function * Streams: unit tests * FFF: tests * Streams: declare cache_size constant as define, to allow variable modified arrays * FFF: lib moved to a separate folder * iButton: new FFF * RFID: new FFF * Animations: new FFF * IR: new FFF * NFC: new FFF * Flipper file format: delete lib * U2F: new FFF * Subghz: new FFF and streams * Streams: read line * Streams: split * FuriCore: implement memset with extra asserts * FuriCore: implement extra heap asserts without inventing memset * Scene manager: protected access to the scene id stack with a size check * NFC worker: dirty fix for issue where hal_nfc was busy on app start * Furi: update allocator to erase memory on allocation. Replace furi_alloc with malloc. * FuriCore: cleanup memmgr code. * Furi HAL: furi_hal_init is split into critical and non-critical parts. The critical part is currently clock and console. * Memmgr: added ability to track allocations and deallocations through console. * FFStream: some speedup * Streams, FF: minor fixes * Tests: restore * File stream: a slightly more thread-safe version of file_stream_delete_and_insert Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
		| @@ -27,7 +27,7 @@ uint32_t bt_debug_start_view(void* context) { | ||||
| } | ||||
|  | ||||
| BtDebugApp* bt_debug_app_alloc() { | ||||
|     BtDebugApp* app = furi_alloc(sizeof(BtDebugApp)); | ||||
|     BtDebugApp* app = malloc(sizeof(BtDebugApp)); | ||||
|  | ||||
|     // Load settings | ||||
|     bt_settings_load(&app->settings); | ||||
|   | ||||
| @@ -130,7 +130,7 @@ static void bt_test_carrier_timer_callback(void* context) { | ||||
| } | ||||
|  | ||||
| BtCarrierTest* bt_carrier_test_alloc() { | ||||
|     BtCarrierTest* bt_carrier_test = furi_alloc(sizeof(BtCarrierTest)); | ||||
|     BtCarrierTest* bt_carrier_test = malloc(sizeof(BtCarrierTest)); | ||||
|     bt_carrier_test->bt_test = bt_test_alloc(); | ||||
|     bt_test_set_context(bt_carrier_test->bt_test, bt_carrier_test); | ||||
|     bt_test_set_change_state_callback( | ||||
|   | ||||
| @@ -98,7 +98,7 @@ static void bt_test_packet_timer_callback(void* context) { | ||||
| } | ||||
|  | ||||
| BtPacketTest* bt_packet_test_alloc() { | ||||
|     BtPacketTest* bt_packet_test = furi_alloc(sizeof(BtPacketTest)); | ||||
|     BtPacketTest* bt_packet_test = malloc(sizeof(BtPacketTest)); | ||||
|     bt_packet_test->bt_test = bt_test_alloc(); | ||||
|     bt_test_set_context(bt_packet_test->bt_test, bt_packet_test); | ||||
|     bt_test_set_change_state_callback( | ||||
|   | ||||
| @@ -291,7 +291,7 @@ void bt_test_process_back(BtTest* bt_test) { | ||||
| } | ||||
|  | ||||
| BtTest* bt_test_alloc() { | ||||
|     BtTest* bt_test = furi_alloc(sizeof(BtTest)); | ||||
|     BtTest* bt_test = malloc(sizeof(BtTest)); | ||||
|     bt_test->view = view_alloc(); | ||||
|     view_set_context(bt_test->view, bt_test); | ||||
|     view_allocate_model(bt_test->view, ViewModelTypeLocking, sizeof(BtTestModel)); | ||||
|   | ||||
| @@ -54,7 +54,7 @@ void bt_hid_connection_status_changed_callback(BtStatus status, void* context) { | ||||
| } | ||||
|  | ||||
| BtHid* bt_hid_app_alloc() { | ||||
|     BtHid* app = furi_alloc(sizeof(BtHid)); | ||||
|     BtHid* app = malloc(sizeof(BtHid)); | ||||
|  | ||||
|     // Gui | ||||
|     app->gui = furi_record_open("gui"); | ||||
|   | ||||
| @@ -161,7 +161,7 @@ static bool bt_hid_keynote_input_callback(InputEvent* event, void* context) { | ||||
| } | ||||
|  | ||||
| BtHidKeynote* bt_hid_keynote_alloc() { | ||||
|     BtHidKeynote* bt_hid_keynote = furi_alloc(sizeof(BtHidKeynote)); | ||||
|     BtHidKeynote* bt_hid_keynote = malloc(sizeof(BtHidKeynote)); | ||||
|     bt_hid_keynote->view = view_alloc(); | ||||
|     view_set_context(bt_hid_keynote->view, bt_hid_keynote); | ||||
|     view_allocate_model(bt_hid_keynote->view, ViewModelTypeLocking, sizeof(BtHidKeynoteModel)); | ||||
|   | ||||
| @@ -162,7 +162,7 @@ static bool bt_hid_media_input_callback(InputEvent* event, void* context) { | ||||
| } | ||||
|  | ||||
| BtHidMedia* bt_hid_media_alloc() { | ||||
|     BtHidMedia* bt_hid_media = furi_alloc(sizeof(BtHidMedia)); | ||||
|     BtHidMedia* bt_hid_media = malloc(sizeof(BtHidMedia)); | ||||
|     bt_hid_media->view = view_alloc(); | ||||
|     view_set_context(bt_hid_media->view, bt_hid_media); | ||||
|     view_allocate_model(bt_hid_media->view, ViewModelTypeLocking, sizeof(BtHidMediaModel)); | ||||
|   | ||||
| @@ -101,7 +101,7 @@ static void bt_battery_level_changed_callback(const void* _event, void* context) | ||||
| } | ||||
|  | ||||
| Bt* bt_alloc() { | ||||
|     Bt* bt = furi_alloc(sizeof(Bt)); | ||||
|     Bt* bt = malloc(sizeof(Bt)); | ||||
|     // Init default maximum packet size | ||||
|     bt->max_packet_size = FURI_HAL_BT_SERIAL_PACKET_SIZE_MAX; | ||||
|     bt->profile = BtProfileSerial; | ||||
|   | ||||
| @@ -13,7 +13,7 @@ static bool bt_settings_back_event_callback(void* context) { | ||||
| } | ||||
|  | ||||
| BtSettingsApp* bt_settings_app_alloc() { | ||||
|     BtSettingsApp* app = furi_alloc(sizeof(BtSettingsApp)); | ||||
|     BtSettingsApp* app = malloc(sizeof(BtSettingsApp)); | ||||
|  | ||||
|     // Load settings | ||||
|     bt_settings_load(&app->settings); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user