2 //metadoc Tag copyright Steve Dekorte 2002
3 //metadoc Tag license BSD revised
13 IoTag
*IoTag_new(void)
15 IoTag
*self
= (IoTag
*)io_calloc(1, sizeof(IoTag
));
16 #ifdef IOMESSAGE_INLINE_PERFORM
17 self
->performFunc
= NULL
;
19 self
->performFunc
= (IoTagPerformFunc
*)IoObject_perform
;
22 self
->referenceCount
= 1;
23 //self->recyclableInstances = Stack_new();
24 //self->maxRecyclableInstances = 10000;
28 IoTag
*IoTag_newWithName_(const char *name
)
30 IoTag
*self
= IoTag_new();
31 IoTag_name_(self
, name
);
35 void IoTag_free(IoTag
*self
)
37 //printf("io_free tag %p\n", (void *)self);
38 //printf("%s\n", self->name ? self->name : "NULL");
39 if (--self
->referenceCount
> 0) {
43 if (self
->tagCleanupFunc
)
45 (self
->tagCleanupFunc
)(self
);
54 //Stack_free(self->recyclableInstances);
58 int IoTag_reference(IoTag
*self
)
60 return ++self
->referenceCount
;
63 void IoTag_name_(IoTag
*self
, const char *name
)
65 self
->name
= strcpy((char *)io_realloc(self
->name
, strlen(name
)+1), name
);
68 const char *IoTag_name(IoTag
*self
)
73 void IoTag_mark(IoTag
*self
)
76 if (Stack_count(self->recyclableInstances))
78 Stack_do_(self->recyclableInstances, (StackDoCallback *)IoObject_shouldMark);