cfw_new() takes parameters now.

This commit is contained in:
Jonathan Schleifer 2012-04-08 19:32:57 +02:00
parent 8603645700
commit a9e4c2a8d9
6 changed files with 43 additions and 31 deletions

View file

@ -29,7 +29,7 @@
#include "cfwobject.h"
void*
cfw_new(CFWClass *class)
cfw_new(CFWClass *class, ...)
{
CFWObject *obj;
@ -39,8 +39,17 @@ cfw_new(CFWClass *class)
obj->clsptr = class;
obj->ref_cnt = 1;
if (class->ctor != NULL)
class->ctor(obj);
if (class->ctor != NULL) {
va_list args;
va_start(args, class);
if (!class->ctor(obj, args)) {
cfw_unref(obj);
return NULL;
}
va_end(args);
}
return obj;
}