diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2013-12-04 13:46:27 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2013-12-04 13:46:27 +0000 |
commit | ca71631abf85ec2d2519517ba7e8e586f8a6394e (patch) | |
tree | 8dc34c84a76b47cd6442df2a09b943b16d784454 /src/ucl | |
parent | 1be9010b73e9bbf60559fcc65ece061c67172339 (diff) | |
download | rspamd-ca71631abf85ec2d2519517ba7e8e586f8a6394e.tar.gz rspamd-ca71631abf85ec2d2519517ba7e8e586f8a6394e.zip |
Forgot to import.
Diffstat (limited to 'src/ucl')
-rw-r--r-- | src/ucl/include/ucl.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/ucl/include/ucl.h b/src/ucl/include/ucl.h index f7390c9a7..3b4008e87 100644 --- a/src/ucl/include/ucl.h +++ b/src/ucl/include/ucl.h @@ -104,7 +104,8 @@ enum ucl_type { UCL_STRING, //!< UCL_STRING UCL_BOOLEAN, //!< UCL_BOOLEAN UCL_TIME, //!< UCL_TIME - UCL_USERDATA //!< UCL_USERDATA + UCL_USERDATA, //!< UCL_USERDATA + UCL_NULL //!< UCL_NULL }; /** @@ -201,6 +202,26 @@ ucl_object_new (void) if (new != NULL) { memset (new, 0, sizeof (ucl_object_t)); new->ref = 1; + new->type = UCL_NULL; + } + return new; +} + +/** + * Create new object with type specified + * @param type type of a new object + * @return new object + */ +static inline ucl_object_t* ucl_object_typed_new (unsigned int type) UCL_WARN_UNUSED_RESULT; +static inline ucl_object_t * +ucl_object_typed_new (unsigned int type) +{ + ucl_object_t *new; + new = malloc (sizeof (ucl_object_t)); + if (new != NULL) { + memset (new, 0, sizeof (ucl_object_t)); + new->ref = 1; + new->type = (type <= UCL_NULL ? type : UCL_NULL); } return new; } |