From a0199be503b8ca2ce73433eaf5ee4116923d03a7 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 6 Jan 2017 07:06:51 -0600 Subject: [PATCH] Font cache in libnx needs to use context-specific memory allocators. --- libnx/nxfonts/nxfonts_cache.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/libnx/nxfonts/nxfonts_cache.c b/libnx/nxfonts/nxfonts_cache.c index f8222ab10f..2f6817ab44 100644 --- a/libnx/nxfonts/nxfonts_cache.c +++ b/libnx/nxfonts/nxfonts_cache.c @@ -45,7 +45,6 @@ #include #include -#include #include /**************************************************************************** @@ -98,7 +97,7 @@ static void nxf_freeglyph(FAR struct nxfonts_glyph_s *glyph) { if (glyph->bitmap) { - kmm_free(glyph->bitmap); + lib_free(glyph->bitmap); } memset(glyph, 0, sizeof(struct nxfonts_glyph_s)); @@ -241,7 +240,7 @@ nxf_renderglyph(FAR struct nxfonts_fcache_s *priv, /* Allocate memory to hold the glyph with its offsets */ bmsize = glyph->stride * glyph->height; - glyph->bitmap = (FAR uint8_t *)kmm_malloc(bmsize); + glyph->bitmap = (FAR uint8_t *)lib_malloc(bmsize); if (glyph->bitmap) { @@ -402,7 +401,7 @@ FCACHE nxf_cache_connect(enum nx_fontid_e fontid, /* Allocate memory for the (empty) font cache */ priv = (FAR struct nxfonts_fcache_s *) - kmm_malloc(sizeof( struct nxfonts_fcache_s)); + lib_zalloc(sizeof( struct nxfonts_fcache_s)); if (priv == NULL) { @@ -494,7 +493,7 @@ FCACHE nxf_cache_connect(enum nx_fontid_e fontid, return (FCACHE)priv; errout_with_fcache: - kmm_free(priv); + lib_free(priv); errout: set_errno(errcode); return NULL; @@ -546,7 +545,7 @@ void nxf_cache_disconnect(FCACHE fcache) FAR struct nxfonts_glyph_s *glyph = &priv->glyph[i]; if (glyph->bitmap) { - kmm_free(glyph->bitmap); + lib_free(glyph->bitmap); } } @@ -556,7 +555,7 @@ void nxf_cache_disconnect(FCACHE fcache) /* Finally, free the font cache stucture itself */ - kmm_free(fcache); + lib_free(fcache); } else {