Skip to content

Commit 4ad16fd

Browse files
committed
Move overlay max size constant to top
1 parent dc0923c commit 4ad16fd

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/displayapp/screens/Pawn.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ using namespace Pinetime::Applications::Screens;
2222

2323
#define PAWN_INST ((Pawn*) amx->userdata[0])
2424

25+
constexpr int max_overlay_size = 512;
26+
2527
static void event_handler(lv_obj_t* obj, lv_event_t event) {
2628
AMX* amx = (AMX*) lv_obj_get_user_data(lv_scr_act());
2729
int handler_index = (int) lv_obj_get_user_data(obj);
@@ -374,12 +376,12 @@ int Pawn::LoadProgram() {
374376

375377
memcpy(datablock, program + hdr.dat, hdr.hea - hdr.dat);
376378

377-
constexpr int poolsize = 512;
378-
overlaypool = malloc(poolsize + 8);
379+
constexpr int overlaypool_overhead = 8;
380+
overlaypool = malloc(max_overlay_size + overlaypool_overhead);
379381
if (overlaypool == NULL)
380382
return AMX_ERR_MEMORY;
381383

382-
amx_poolinit(overlaypool, poolsize + 8);
384+
amx_poolinit(overlaypool, max_overlay_size + overlaypool_overhead);
383385

384386
amx.data = (unsigned char*) datablock;
385387
amx.overlay = prun_Overlay;

0 commit comments

Comments
 (0)