summaryrefslogtreecommitdiff
path: root/nuttx/graphics
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-12-30 12:42:18 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-12-30 12:42:18 -0600
commitfd95f9ae75acb674be870e3a92c05816bcbbd819 (patch)
treed34df38748ca5e93ba645eae411983c56ea5d964 /nuttx/graphics
parent8ca22c23fa3fa96cf661888f6b8a104d4c1cbd1b (diff)
downloadnuttx-fd95f9ae75acb674be870e3a92c05816bcbbd819.tar.gz
nuttx-fd95f9ae75acb674be870e3a92c05816bcbbd819.tar.bz2
nuttx-fd95f9ae75acb674be870e3a92c05816bcbbd819.zip
NX: Use a consistent allocator in all configurations
Diffstat (limited to 'nuttx/graphics')
-rw-r--r--nuttx/graphics/nxbe/nxbe_clipper.c2
-rw-r--r--nuttx/graphics/nxbe/nxbe_closewindow.c12
-rw-r--r--nuttx/graphics/nxsu/nx_close.c4
-rw-r--r--nuttx/graphics/nxsu/nx_constructwindow.c2
-rw-r--r--nuttx/graphics/nxsu/nx_open.c6
-rw-r--r--nuttx/graphics/nxsu/nx_openwindow.c6
6 files changed, 21 insertions, 11 deletions
diff --git a/nuttx/graphics/nxbe/nxbe_clipper.c b/nuttx/graphics/nxbe/nxbe_clipper.c
index 1c33dd243..4b7293ae6 100644
--- a/nuttx/graphics/nxbe/nxbe_clipper.c
+++ b/nuttx/graphics/nxbe/nxbe_clipper.c
@@ -110,7 +110,7 @@ static inline void nxbe_pushrectangle(FAR struct nxbe_clipstack_s *stack,
if ((stack->npushed + 1) > stack->mxrects)
{
- /* No then we will need to reallocate the stack to hole more */
+ /* No then we will need to reallocate the stack to hold more */
int mxrects = stack->mxrects ? 2 * stack->mxrects : NX_INITIAL_STACKSIZE;
struct nxbe_cliprect_s *newstack;
diff --git a/nuttx/graphics/nxbe/nxbe_closewindow.c b/nuttx/graphics/nxbe/nxbe_closewindow.c
index e632ebf01..09c47af22 100644
--- a/nuttx/graphics/nxbe/nxbe_closewindow.c
+++ b/nuttx/graphics/nxbe/nxbe_closewindow.c
@@ -39,11 +39,12 @@
#include <nuttx/config.h>
-#include <stdlib.h>
#include <assert.h>
#include <debug.h>
+#include <nuttx/kmalloc.h>
#include <nuttx/nx/nxglib.h>
+
#include "nxbe.h"
/****************************************************************************
@@ -77,7 +78,8 @@
* Close an existing window
*
* Input Parameters:
- * wnd - The window to be closed (and deallocated)
+ * wnd - The window to be closed (and deallocated using the user-space
+ * allocator)
*
* Return:
* None
@@ -131,7 +133,9 @@ void nxbe_closewindow(struct nxbe_window_s *wnd)
nxbe_redrawbelow(be, wnd->below, &wnd->bounds);
- /* Then discard the window structure */
+ /* Then discard the window structure. Here we assume that the user-space
+ * allocator was used.
+ */
- free(wnd);
+ umm_free(wnd);
}
diff --git a/nuttx/graphics/nxsu/nx_close.c b/nuttx/graphics/nxsu/nx_close.c
index c1b9d1537..848513b5c 100644
--- a/nuttx/graphics/nxsu/nx_close.c
+++ b/nuttx/graphics/nxsu/nx_close.c
@@ -88,6 +88,8 @@
void nx_close(NXHANDLE handle)
{
- kfree(handle);
+ /* For consistency, we use the user-space allocate (if available) */
+
+ umm_free(handle);
}
diff --git a/nuttx/graphics/nxsu/nx_constructwindow.c b/nuttx/graphics/nxsu/nx_constructwindow.c
index 6a0595181..1be780a2a 100644
--- a/nuttx/graphics/nxsu/nx_constructwindow.c
+++ b/nuttx/graphics/nxsu/nx_constructwindow.c
@@ -116,7 +116,7 @@ int nx_constructwindow(NXHANDLE handle, NXWINDOW wnd,
if (!fe || !cb)
{
- kfree(wnd);
+ umm_free(wnd);
errno = EINVAL;
return ERROR;
}
diff --git a/nuttx/graphics/nxsu/nx_open.c b/nuttx/graphics/nxsu/nx_open.c
index d8efcee41..4866f15ce 100644
--- a/nuttx/graphics/nxsu/nx_open.c
+++ b/nuttx/graphics/nxsu/nx_open.c
@@ -195,9 +195,11 @@ NXHANDLE nx_open(FAR NX_DRIVERTYPE *dev)
}
#endif
- /* Allocate the NX state structure */
+ /* Allocate the NX state structure. The user-space allocator is used
+ * (if available) for compatibility with the multi-user implementation.
+ */
- fe = (FAR struct nxfe_state_s *)kzalloc(sizeof(struct nxfe_state_s));
+ fe = (FAR struct nxfe_state_s *)umm_zalloc(sizeof(struct nxfe_state_s));
if (!fe)
{
errno = ENOMEM;
diff --git a/nuttx/graphics/nxsu/nx_openwindow.c b/nuttx/graphics/nxsu/nx_openwindow.c
index b1e632937..d085ad03e 100644
--- a/nuttx/graphics/nxsu/nx_openwindow.c
+++ b/nuttx/graphics/nxsu/nx_openwindow.c
@@ -103,9 +103,11 @@ NXWINDOW nx_openwindow(NXHANDLE handle, FAR const struct nx_callback_s *cb,
}
#endif
- /* Pre-allocate the window structure */
+ /* Pre-allocate the window structure. The user-space allocator is used (if
+ * available) for compatibility with the multi-user implementation.
+ */
- wnd = (FAR struct nxbe_window_s *)kzalloc(sizeof(struct nxbe_window_s));
+ wnd = (FAR struct nxbe_window_s *)umm_zalloc(sizeof(struct nxbe_window_s));
if (!wnd)
{
errno = ENOMEM;