summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2017-08-23 17:24:52 -0300
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2017-08-23 18:32:13 -0300
commit4da53492ae1235a728d1335fdc7e3cc214df9763 (patch)
treef36f904d3a1047d845a48312f3e4f94a9c40f6eb
parent95f59ecd517b878316829389f3a0e90a8047786b (diff)
add EINA_VALUE_EMPTY, allow flushing empty values.
EINA_VALUE_EMPTY is basically a zeroed Eina_Value, handy for declaring and returning. To cope with the rest of efl, free/del/flush on NULL shouldn't complain, so flusing an empty value should be quiet.
-rw-r--r--src/lib/eina/eina_inline_value.x1
-rw-r--r--src/lib/eina/eina_value.h10
2 files changed, 11 insertions, 0 deletions
diff --git a/src/lib/eina/eina_inline_value.x b/src/lib/eina/eina_inline_value.x
index 649e1de2a8..b8614c7ea9 100644
--- a/src/lib/eina/eina_inline_value.x
+++ b/src/lib/eina/eina_inline_value.x
@@ -136,6 +136,7 @@ eina_value_flush(Eina_Value *value)
136 const Eina_Value_Type *type; 136 const Eina_Value_Type *type;
137 void *mem; 137 void *mem;
138 138
139 if (!value || !value->type) return;
139 EINA_VALUE_TYPE_CHECK_RETURN(value); 140 EINA_VALUE_TYPE_CHECK_RETURN(value);
140 141
141 type = value->type; 142 type = value->type;
diff --git a/src/lib/eina/eina_value.h b/src/lib/eina/eina_value.h
index d163b11d5b..756314cb85 100644
--- a/src/lib/eina/eina_value.h
+++ b/src/lib/eina/eina_value.h
@@ -305,6 +305,16 @@
305typedef struct _Eina_Value Eina_Value; 305typedef struct _Eina_Value Eina_Value;
306 306
307/** 307/**
308 * @def EINA_VALUE_EMPTY
309 *
310 * This is simply a value with all memory zeroed. It may be used
311 * to safely initialize or return a value without a type.
312 *
313 * @since 1.21
314 */
315#define EINA_VALUE_EMPTY ((Eina_Value){ 0 })
316
317/**
308 * @typedef Eina_Value_Type 318 * @typedef Eina_Value_Type
309 * Describes the data contained by the value. 319 * Describes the data contained by the value.
310 * 320 *