Mercurial > MadButterfly
comparison src/observer.c @ 77:a6763f080da5
-
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Wed, 20 Aug 2008 00:32:11 +0800 |
parents | 3e3e074120a7 |
children | 1c1f28c124c9 |
comparison
equal
deleted
inserted
replaced
76:8706356a61b4 | 77:a6763f080da5 |
---|---|
30 | 30 |
31 | 31 |
32 void subject_notify(ob_factory_t *factory, subject_t *subject, event_t *evt) { | 32 void subject_notify(ob_factory_t *factory, subject_t *subject, event_t *evt) { |
33 observer_t *observer; | 33 observer_t *observer; |
34 | 34 |
35 evt->tgt = subject; | |
35 while(subject) { | 36 while(subject) { |
37 evt->cur_tgt = subject->obj; | |
36 for(observer = STAILQ_HEAD(subject->observers); | 38 for(observer = STAILQ_HEAD(subject->observers); |
37 observer != NULL; | 39 observer != NULL; |
38 observer = STAILQ_NEXT(observer_t, next, observer)) { | 40 observer = STAILQ_NEXT(observer_t, next, observer)) { |
39 observer->hdr(evt, observer->arg); | 41 observer->hdr(evt, observer->arg); |
40 } | 42 } |