From: Sebastian Harl Date: Sat, 17 Aug 2013 18:35:00 +0000 (+0200) Subject: object: Added sdb_object_vcreate(). X-Git-Tag: sysdb-0.1.0~381 X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=commitdiff_plain;h=e97728dc23dba720769eed4de91b7fd293f40e47 object: Added sdb_object_vcreate(). This function expects an va_list argument rather than a "true" variadic list of arguments. --- diff --git a/src/core/object.c b/src/core/object.c index 7fbd5f0..d6665e7 100644 --- a/src/core/object.c +++ b/src/core/object.c @@ -75,7 +75,7 @@ static sdb_type_t sdb_object_wrapper_type = { */ sdb_object_t * -sdb_object_create(const char *name, sdb_type_t type, ...) +sdb_object_vcreate(const char *name, sdb_type_t type, va_list ap) { sdb_object_t *obj; @@ -97,22 +97,28 @@ sdb_object_create(const char *name, sdb_type_t type, ...) } if (type.init) { - va_list ap; - va_start(ap, type); - if (type.init(obj, ap)) { obj->ref_cnt = 1; sdb_object_deref(obj); - va_end(ap); return NULL; } - - va_end(ap); } obj->type = type; obj->ref_cnt = 1; return obj; +} /* sdb_object_vcreate */ + +sdb_object_t * +sdb_object_create(const char *name, sdb_type_t type, ...) +{ + sdb_object_t *obj; + va_list ap; + + va_start(ap, type); + obj = sdb_object_vcreate(name, type, ap); + va_end(ap); + return obj; } /* sdb_object_create */ sdb_object_t * diff --git a/src/include/core/object.h b/src/include/core/object.h index 016e718..23cd856 100644 --- a/src/include/core/object.h +++ b/src/include/core/object.h @@ -89,6 +89,8 @@ typedef struct { */ sdb_object_t * sdb_object_create(const char *name, sdb_type_t type, ...); +sdb_object_t * +sdb_object_vcreate(const char *name, sdb_type_t type, va_list ap); /* * sdb_object_create_wrapper: