summaryrefslogtreecommitdiff
path: root/apps/gui/icon.c
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-04-03 11:16:39 +0100
committerAidan MacDonald <amachronic@protonmail.com>2022-10-16 14:50:39 +0100
commit1718cf5f8a39b922eba3ad1b3c9a9570188362b1 (patch)
tree4f6bf81cb4f382ca04856b98492289825133c5ae /apps/gui/icon.c
parentb16bae6fe624d30631bf83290e204197ab136c12 (diff)
downloadrockbox-1718cf5f8a39b922eba3ad1b3c9a9570188362b1.tar.gz
rockbox-1718cf5f8a39b922eba3ad1b3c9a9570188362b1.zip
Convert a number of allocations to use buflib pinning
Several places in the codebase implemented an ad-hoc form of pinning; they can be converted to use buflib pinning instead. Change-Id: I4450be007e80f6c9cc9f56c2929fa4b9b85ebff3
Diffstat (limited to 'apps/gui/icon.c')
-rw-r--r--apps/gui/icon.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/apps/gui/icon.c b/apps/gui/icon.c
index 9fe7090f4a..e78aa6841c 100644
--- a/apps/gui/icon.c
+++ b/apps/gui/icon.c
@@ -63,7 +63,6 @@ static struct iconset {
63 struct bitmap bmp; 63 struct bitmap bmp;
64 bool loaded; 64 bool loaded;
65 int handle; 65 int handle;
66 int handle_locked;
67} iconsets[Iconset_Count][NB_SCREENS]; 66} iconsets[Iconset_Count][NB_SCREENS];
68 67
69#define ICON_HEIGHT(screen) (!iconsets[Iconset_user][screen].loaded ? \ 68#define ICON_HEIGHT(screen) (!iconsets[Iconset_user][screen].loaded ? \
@@ -160,8 +159,6 @@ static int buflib_move_callback(int handle, void* current, void* new)
160 struct iconset *set = &iconsets[i][j]; 159 struct iconset *set = &iconsets[i][j];
161 if (set->bmp.data == current) 160 if (set->bmp.data == current)
162 { 161 {
163 if (set->handle_locked > 0)
164 return BUFLIB_CB_CANNOT_MOVE;
165 set->bmp.data = new; 162 set->bmp.data = new;
166 return BUFLIB_CB_OK; 163 return BUFLIB_CB_OK;
167 } 164 }
@@ -201,11 +198,10 @@ static void load_icons(const char* filename, enum Iconset iconset,
201 goto finished; 198 goto finished;
202 } 199 }
203 lseek(fd, 0, SEEK_SET); 200 lseek(fd, 0, SEEK_SET);
201 core_pin(ic->handle);
204 ic->bmp.data = core_get_data(ic->handle); 202 ic->bmp.data = core_get_data(ic->handle);
205
206 ic->handle_locked = 1;
207 size_read = read_bmp_fd(fd, &ic->bmp, buf_size, bmpformat, NULL); 203 size_read = read_bmp_fd(fd, &ic->bmp, buf_size, bmpformat, NULL);
208 ic->handle_locked = 0; 204 core_unpin(ic->handle);
209 205
210 if (size_read < 0) 206 if (size_read < 0)
211 { 207 {