aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Hannam <andrewh@inmarket.com.au>2012-11-17 18:09:11 +1000
committerAndrew Hannam <andrewh@inmarket.com.au>2012-11-17 18:09:11 +1000
commit59c13aa33b509ddb5cda070401534440ac7f6d11 (patch)
tree11acb084de131cadf3d869aa3f018507354e48f9 /src
parenta762a629aa49a046453de7fd2d65680e73c9123a (diff)
downloaduGFX-59c13aa33b509ddb5cda070401534440ac7f6d11.tar.gz
uGFX-59c13aa33b509ddb5cda070401534440ac7f6d11.tar.bz2
uGFX-59c13aa33b509ddb5cda070401534440ac7f6d11.zip
Change dynamic memory allocator in GWIN
Change dynamic memory allocator in GWIN to use the ChibiOS routines
Diffstat (limited to 'src')
-rw-r--r--src/gwin.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gwin.c b/src/gwin.c
index 344252f9..83e0be54 100644
--- a/src/gwin.c
+++ b/src/gwin.c
@@ -58,7 +58,7 @@ static GHandle gwinInit(GWindowObject *gw, coord_t x, coord_t y, coord_t width,
// Allocate the structure if necessary
if (!gw) {
- if (!(gw = (GWindowObject *)malloc(size)))
+ if (!(gw = (GWindowObject *)chHeapAlloc(NULL, size)))
return 0;
gw->flags = GWIN_FLG_DYNAMIC;
} else
@@ -113,7 +113,7 @@ void gwinDestroyWindow(GHandle gh) {
case GW_BUTTON:
if ((gh->flags & GBTN_FLG_ALLOCTXT)) {
gh->flags &= ~GBTN_FLG_ALLOCTXT; // To be sure, to be sure
- free((char *)((GButtonObject *)gh)->txt);
+ chHeapFree(((GButtonObject *)gh)->txt);
}
break;
#endif
@@ -124,7 +124,7 @@ void gwinDestroyWindow(GHandle gh) {
// Clean up the structure
if (gh->flags & GWIN_FLG_DYNAMIC) {
gh->flags = 0; // To be sure, to be sure
- free(gh);
+ chHeapFree(gh);
}
}
@@ -799,7 +799,7 @@ void gwinSetButtonText(GHandle gh, const char *txt, bool_t useAlloc) {
if ((gh->flags & GBTN_FLG_ALLOCTXT)) {
gh->flags &= ~GBTN_FLG_ALLOCTXT;
if (gbw->txt) {
- free((char *)gbw->txt);
+ chHeapFree(gbw->txt);
gbw->txt = "";
}
}
@@ -807,7 +807,7 @@ void gwinSetButtonText(GHandle gh, const char *txt, bool_t useAlloc) {
if (txt && useAlloc) {
char *str;
- if ((str = (char *)malloc(strlen(txt)+1))) {
+ if ((str = (char *)chHeapAlloc(NULL, strlen(txt)+1))) {
gh->flags |= GBTN_FLG_ALLOCTXT;
strcpy(str, txt);
}