/** * Allocate a new object of kind specified by the operations handle * @arg ops operations handle * @return The new object or NULL */ struct Filter *Filter_alloc(struct Filter_ops *fo_ops) { struct Filter *new_filter; struct Object_ops *obj_ops = fo_ops->ops; if (obj_ops->obj_size < sizeof(*new_filter)) BUG(); new_filter = (struct Filter *) Object_alloc(obj_ops); if (!new_filter) return NULL; DBG(4, "Allocated new filter object %p\n", new_filter); new_filter->fo_ops = fo_ops; if (fo_ops->foo_constructor) { DBG(4, "New filter object %p has constructor\n", new_filter); fo_ops->foo_constructor(new_filter); } return new_filter; }
static struct Rule* Rule_alloc(struct Object_ops *ops) { return (struct Rule*) Object_alloc(ops); }
inline void Object_init () { Object_alloc (&__Object); }