From 8aa66a6c6c0d8984b7d2668c03bad5a3b29e3a33 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Sun, 5 Oct 2025 15:41:23 +0200 Subject: memops wrapper, remove unused includes --- src/ui/imgui_extensions.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src/ui/imgui_extensions.cpp') diff --git a/src/ui/imgui_extensions.cpp b/src/ui/imgui_extensions.cpp index 4e8270a..ee0bebb 100644 --- a/src/ui/imgui_extensions.cpp +++ b/src/ui/imgui_extensions.cpp @@ -1,7 +1,6 @@ -#include - #include "ui.hpp" #include "strops.hpp" +#include "memops.hpp" #include "config.hpp" #include "locales.hpp" #include "administration.hpp" @@ -225,7 +224,7 @@ namespace ImGui for (int i = 0; i < autocomplete_count; i++) { - autocomplete_strings[i] = (char*)malloc(200); + autocomplete_strings[i] = (char*)memops::alloc(200); strops::format(autocomplete_strings[i], 200, "%s (%s %s)", autocomplete_list[i].name, autocomplete_list[i].address.address1, autocomplete_list[i].address.address2); } @@ -234,19 +233,19 @@ namespace ImGui if (autocomplete_index != -1) { - memcpy(buffer, &autocomplete_list[autocomplete_index], sizeof(contact)); + memops::copy(buffer, &autocomplete_list[autocomplete_index], sizeof(contact)); } for (int i = 0; i < autocomplete_count; i++) { - free(autocomplete_strings[i]); + memops::unalloc(autocomplete_strings[i]); } } void FormCostCenterCombo(char* costcenter_id) { u32 costcenter_count = administration::cost_center_count(); - cost_center* buffer = (cost_center*) malloc(sizeof(cost_center) * costcenter_count); + cost_center* buffer = (cost_center*) memops::alloc(sizeof(cost_center) * costcenter_count); cost_center* selected_costcenter = NULL; costcenter_count = administration::cost_center_get_all(buffer); @@ -281,13 +280,13 @@ namespace ImGui strops::copy(costcenter_id, buffer[selected_costcenter_index].id, MAX_LEN_ID); } - free(buffer); + memops::unalloc(buffer); } void FormProjectCombo(char* project_id) { u32 project_count = administration::project_count(); - project* buffer = (project*) malloc(sizeof(project) * project_count); + project* buffer = (project*) memops::alloc(sizeof(project) * project_count); project* selected_project = NULL; project_count = administration::project_get_all(buffer); @@ -322,13 +321,13 @@ namespace ImGui strops::copy(project_id, buffer[selected_project_index].id, MAX_LEN_ID); } - free(buffer); + memops::unalloc(buffer); } void FormTaxRateCombo(char* tax_rate_id, char* orig_country, char* dest_country, bool has_error) { u32 tax_rate_count = administration::tax_rate_count(); - tax_rate* buffer = (tax_rate*) malloc(sizeof(tax_rate) * tax_rate_count); + tax_rate* buffer = (tax_rate*) memops::alloc(sizeof(tax_rate) * tax_rate_count); tax_rate* selected_tax_rate = NULL; char* tax_country_codes[2] = {orig_country, dest_country}; @@ -394,7 +393,7 @@ namespace ImGui strops::copy(tax_rate_id, buffer[selected_tax_rate_index].id, MAX_LEN_ID); } - free(buffer); + memops::unalloc(buffer); } bool FormCurrencyCombo(char* currency) -- cgit v1.2.3-70-g09d2