@@ -202,7 +202,7 @@ void CCScheduler::scheduleSelector(SEL_SCHEDULE pfnSelector, SelectorProtocol *p
202202
203203 if (! pElement)
204204 {
205- pElement = (tHashSelectorEntry *) calloc ( sizeof (*pElement), 1 ) ;
205+ pElement = new tHashSelectorEntry ;
206206 pElement->target = pTarget;
207207 HASH_ADD_INT (m_pHashForSelectors, target, pElement);
208208
@@ -287,7 +287,7 @@ void CCScheduler::unscheduleSelector(SEL_SCHEDULE pfnSelector, SelectorProtocol
287287
288288void CCScheduler::priorityIn (tListEntry **ppList, SelectorProtocol *pTarget, int nPriority, bool bPaused)
289289{
290- tListEntry *pListElement = (tListEntry *) malloc ( sizeof (*pListElement)) ;
290+ tListEntry *pListElement = new tListEntry ;
291291
292292 pListElement->target = pTarget;
293293 pListElement->priority = nPriority;
@@ -332,11 +332,18 @@ void CCScheduler::priorityIn(tListEntry **ppList, SelectorProtocol *pTarget, int
332332 DL_APPEND (*ppList, pListElement);
333333 }
334334 }
335+
336+ // update hash entry for quick access
337+ tHashUpdateEntry *pHashElement = new tHashUpdateEntry ();
338+ pHashElement->target = pTarget;
339+ pHashElement->list = ppList;
340+ pHashElement->entry = pListElement;
341+ HASH_ADD_INT (m_pHashForUpdates, target, pHashElement);
335342}
336343
337344void CCScheduler::appendIn (_listEntry **ppList, SelectorProtocol *pTarget, bool bPaused)
338345{
339- tListEntry *pListElement = (tListEntry *) malloc ( sizeof (*pListElement)) ;
346+ tListEntry *pListElement = new tListEntry ;
340347
341348 pListElement->target = pTarget;
342349 pListElement->paused = bPaused;
0 commit comments