summaryrefslogtreecommitdiff
path: root/src/ui/imgui_extensions.cpp
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2025-10-05 15:41:23 +0200
committerAldrik Ramaekers <aldrikboy@gmail.com>2025-10-05 15:41:23 +0200
commit8aa66a6c6c0d8984b7d2668c03bad5a3b29e3a33 (patch)
treed7d985151b5bcd6687aead3547bdfbdb0600a8c6 /src/ui/imgui_extensions.cpp
parentb278d242d03ba614779243ec9e9495fc95abea3d (diff)
memops wrapper, remove unused includes
Diffstat (limited to 'src/ui/imgui_extensions.cpp')
-rw-r--r--src/ui/imgui_extensions.cpp21
1 files changed, 10 insertions, 11 deletions
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 <stdlib.h>
-
#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)