0 Members and 1 Guest are viewing this topic.
typedef struct { void* prevl,*prevd; char canUndo:1,isUndone:1;} UndoInfo;void* allocBUB(void){ void* buffer=NULL; if (!(buffer=calloc(LCD_SIZE,1))) { dlgError(DMA_ERROR,MEMALLOC_FAIL); return NULL; } return buffer;}int allocGBUB(void** lbuff,void** dbuff){ if (!(*lbuff=allocBUB())) { return 0; } if (!(*dbuff=allocBUB())) { free(*lbuff); return 0; } return 1;}void enableUndo(UndoInfo* p) { GrayOff(); SetIntVec(AUTO_INT_1,I1); SetIntVec(AUTO_INT_5,I5); //*v: this may be the cause of the gray bars p->canUndo=allocGBUB((void**)p,(void**)((char*)p+4)); SetIntVec(AUTO_INT_1,DUMMY_HANDLER); SetIntVec(AUTO_INT_5,DUMMY_HANDLER); GrayOn();}
But what about pushing most of the code of enableUndo() - and possibly similar routines - to the error path (dlgError()) ?