]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Forgot to import.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 4 Dec 2013 13:46:27 +0000 (13:46 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 4 Dec 2013 13:46:27 +0000 (13:46 +0000)
src/ucl/include/ucl.h

index f7390c9a72803016218aa1f5434ca3c88b832f1b..3b4008e8712424f3294dbe4dfeed77b26b5b7e85 100644 (file)
@@ -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;
 }