summaryrefslogtreecommitdiff
path: root/wintable/new/main.c
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-12-07 16:22:51 -0500
committerPietro Gagliardi <[email protected]>2014-12-07 16:22:51 -0500
commite224950cf48abe0a0d439fb8d4f154fe59984de7 (patch)
treea910737ad2adac740186fd07262b82aee82e1c78 /wintable/new/main.c
parent75c9f738703a355dddb13b0a0c8df9a446550ba1 (diff)
Some allocator cleanup in the new Table.
Diffstat (limited to 'wintable/new/main.c')
-rw-r--r--wintable/new/main.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/wintable/new/main.c b/wintable/new/main.c
index cd0b906..4e2663f 100644
--- a/wintable/new/main.c
+++ b/wintable/new/main.c
@@ -72,11 +72,7 @@ static LRESULT CALLBACK tableWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
if (uMsg == WM_NCCREATE) {
CREATESTRUCTW *cs = (CREATESTRUCTW *) lParam;
- // TODO find something that DOES set a last error code to use instead, or figure out how to abuse SEH temporarily so we can use HeapAlloc()...
- t = (struct table *) malloc(sizeof (struct table));
- if (t == NULL)
- panic("error allocating internal Table data structure");
- ZeroMemory(t, sizeof (struct table));
+ t = (struct table *) tableAlloc(sizeof (struct table), "error allocating internal Table data structure");
t->hwnd = hwnd;
SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR) t);
}
@@ -87,7 +83,7 @@ static LRESULT CALLBACK tableWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
if (uMsg == WM_DESTROY) {
// TODO free appropriate (after figuring this part out) components of t
// TODO send DESTROY events to accessibility listeners (when appropriate)
- free(t);
+ tableFree(t, "error allocating internal Table data structure");
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
}
if (runHandlers(handlers, t, uMsg, wParam, lParam, &lResult))