Changeset 4309:4c11b1ab0498 in roaraudio


Ignore:
Timestamp:
09/07/10 04:05:19 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

implement correct filter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/notify.c

    r4308 r4309  
    161161 struct roar_subscriber * cur, * old; 
    162162 
     163 ROAR_DBG("roar_notify_core_subscribe(core=%p, event=%p, cb=%p, userdata=%p) = ?", core, event, cb, userdata); 
     164 
    163165 _CKRCORE(NULL); 
    164166 
    165167 if ( event == NULL || cb == NULL ) { 
     168  ROAR_DBG("roar_notify_core_subscribe(core=%p, event=%p, cb=%p, userdata=%p) = NULL // errno = EINVAL", core, event, cb, userdata); 
    166169  roar_errno = ROAR_ERROR_INVAL; 
    167170  return NULL; 
     
    169172 
    170173 if ( (subs = roar_mm_malloc(sizeof(struct roar_subscriber))) == NULL ) { 
     174  ROAR_DBG("roar_notify_core_subscribe(core=%p, event=%p, cb=%p, userdata=%p) = NULL // errno = ENOMEM?", core, event, cb, userdata); 
    171175  return NULL; 
    172176 } 
     
    197201 } 
    198202 
     203 ROAR_DBG("roar_notify_core_subscribe(core=%p, event=%p, cb=%p, userdata=%p) = %p", core, event, cb, userdata, subs); 
    199204 return subs; 
    200205} 
     
    205210 _CKICORE(); 
    206211 
    207  if ( subscriber ) { 
     212 if ( subscriber == NULL ) { 
    208213  roar_errno = ROAR_ERROR_INVAL; 
    209214  return -1; 
     
    234239 _CKICORE(); 
    235240 
    236  if ( event ) { 
     241 if ( event == NULL ) { 
    237242  roar_errno = ROAR_ERROR_INVAL; 
    238243  return -1; 
     
    240245 
    241246 cur = core->lists[_hash_event(core, event)]; 
     247 ROAR_DBG("roar_notify_core_emit(core=%p, event=%p): cur=%p", core, event, cur); 
    242248 
    243249 while (cur != NULL) { 
     250  ROAR_DBG("roar_notify_core_emit(core=%p, event=%p): cur=%p", core, event, cur); 
     251 
     252  // test if we can skip this one: 
     253  if ( !( (cur->event       == ROAR_NOTIFY_SPECIAL || cur->event       == event->event)   && 
     254          (cur->emitter     == -1                  || cur->emitter     == event->emitter) && 
     255          (cur->target      == -1                  || cur->target      == event->target)  && 
     256          (cur->target_type == -1                  || cur->target_type == event->target_type) 
     257        ) ) { 
     258   cur = cur->next; 
     259   continue; 
     260  } 
     261 
    244262  if ( cur->cb == NULL ) { 
    245263   ROAR_ERR("roar_notify_core_emit(core=%p, event=%p): cur=%p, cb is set NULL, bad.", core, event, cur); 
Note: See TracChangeset for help on using the changeset viewer.