2 docCopyright("Steve Dekorte", 2002)
3 docLicense("BSD revised")
14 IoTag
*IoTag_new(void)
16 IoTag
*self
= (IoTag
*)io_calloc(1, sizeof(IoTag
));
17 #ifdef IOMESSAGE_INLINE_PERFORM
18 self
->performFunc
= NULL
;
20 self
->performFunc
= (IoTagPerformFunc
*)IoObject_perform
;
23 self
->referenceCount
= 1;
24 //self->recyclableInstances = Stack_new();
25 //self->maxRecyclableInstances = 10000;
29 IoTag
*IoTag_newWithName_(const char *name
)
31 IoTag
*self
= IoTag_new();
32 IoTag_name_(self
, name
);
36 void IoTag_free(IoTag
*self
)
38 //printf("io_free tag %p\n", (void *)self);
39 //printf("%s\n", self->name ? self->name : "NULL");
40 if (--self
->referenceCount
> 0) {
44 if (self
->tagCleanupFunc
)
46 (self
->tagCleanupFunc
)(self
);
55 //Stack_free(self->recyclableInstances);
59 int IoTag_reference(IoTag
*self
)
61 return ++self
->referenceCount
;
64 void IoTag_name_(IoTag
*self
, const char *name
)
66 self
->name
= strcpy((char *)io_realloc(self
->name
, strlen(name
)+1), name
);
69 const char *IoTag_name(IoTag
*self
)
74 void IoTag_mark(IoTag
*self
)
77 if (Stack_count(self->recyclableInstances))
79 Stack_do_(self->recyclableInstances, (StackDoCallback *)IoObject_shouldMark);