Fixing indenting in addons/Socket/samples/EchoServer.io
[io/quag.git] / libs / garbagecollector / source / Collector_inline.h
blob401adb80483b1ee62fdc10af8b487e761d15320f
1 /*#io
2 docCopyright("Steve Dekorte", 2002)
3 docLicense("BSD revised")
4 */
6 #ifdef COLLECTOR_C
7 #define IO_IN_C_FILE
8 #endif
9 #include "Common_inline.h"
10 #ifdef IO_DECLARE_INLINES
12 // inspecting markers -------------------
14 IOINLINE int Collector_markerIsWhite_(Collector *self, CollectorMarker *m)
16 return (self->whites->color == m->color);
19 IOINLINE int Collector_markerIsGray_(Collector *self, CollectorMarker *m)
21 return (COLLECTOR_GRAY == m->color);
24 IOINLINE int Collector_markerIsBlack_(Collector *self, CollectorMarker *m)
26 return (self->blacks->color == m->color);
29 // changing marker colors -------------------
31 IOINLINE void Collector_makeFree_(Collector *self, CollectorMarker *v)
33 CollectorMarker_removeAndInsertAfter_((CollectorMarker *)v, self->freed);
36 IOINLINE void Collector_makeWhite_(Collector *self, CollectorMarker *v)
38 CollectorMarker_removeAndInsertAfter_((CollectorMarker *)v, self->whites);
41 IOINLINE void Collector_makeGray_(Collector *self, CollectorMarker *v)
43 CollectorMarker_removeAndInsertAfter_((CollectorMarker *)v, self->grays);
46 IOINLINE void Collector_makeBlack_(Collector *self, CollectorMarker *v)
48 CollectorMarker_removeAndInsertAfter_((CollectorMarker *)v, self->blacks);
51 IOINLINE void Collector_makeGrayIfWhite_(Collector *self, void *v)
53 if (Collector_markerIsWhite_(self, (CollectorMarker *)v))
55 Collector_makeGray_(self, v);
60 IOINLINE void Collector_makeFreed_(Collector *self, void *v)
62 CollectorMarker_removeAndInsertAfter_(v, self->freed);
66 IOINLINE void *Collector_value_addingRefTo_(Collector *self, void *v, void *ref)
68 if (Collector_markerIsBlack_(self, (CollectorMarker *)v) && Collector_markerIsWhite_(self, (CollectorMarker *)ref))
70 Collector_makeGray_(self, ref);
73 return ref;
76 #undef IO_IN_C_FILE
77 #endif