summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2017-08-27 03:49:46 -0300
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2017-08-27 11:35:38 -0300
commitb2cd2cbf164dc40cb90b69d0174569fe64a64629 (patch)
tree6af1676715260b30de03d7abbed5f248997d23a6
parent07f272b52ed26802db544d82194df4a13ad2ee64 (diff)
fixup Eina: Add Eina_Promise/Eina_Future (convert_to)
convert_to() should just setup for empty, getting the default value. on errors it should convert to EINA_VALUE_TYPE_ERROR, otherwise pass thru.
-rw-r--r--src/lib/eina/eina_promise.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/lib/eina/eina_promise.c b/src/lib/eina/eina_promise.c
index 1eb319437f..2cad75b15c 100644
--- a/src/lib/eina/eina_promise.c
+++ b/src/lib/eina/eina_promise.c
@@ -947,7 +947,17 @@ _eina_future_cb_convert_to(void *data, const Eina_Value src,
947{ 947{
948 const Eina_Value_Type *type = data; 948 const Eina_Value_Type *type = data;
949 Eina_Value dst = EINA_VALUE_EMPTY; 949 Eina_Value dst = EINA_VALUE_EMPTY;
950 if (type && eina_value_setup(&dst, type)) eina_value_convert(&src, &dst); 950
951 if (!type) return src; // pass thru
952
953 if (!eina_value_setup(&dst, type))
954 {
955 eina_value_setup(&dst, EINA_VALUE_TYPE_ERROR);
956 eina_value_set(&dst, ENOMEM);
957 }
958 else if (src.type) eina_value_convert(&src, &dst);
959 // otherwise leave initial value for empty
960
951 return dst; 961 return dst;
952} 962}
953 963