eina: remove eina_promise_data_get has it lead to risky use.
authorCedric BAIL <cedric.bail@free.fr>
Sat, 5 Jan 2019 01:55:14 +0000 (17:55 -0800)
committerJunsuChoi <jsuya.choi@samsung.com>
Thu, 24 Jan 2019 05:20:18 +0000 (14:20 +0900)
It seems that use of eina_promise_data_get lead to mostly missuse. As it
duplicate other infrastructure which do not have the same problem. So better
remove it and if we need it back, we can just revert this patch later.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Differential Revision: https://phab.enlightenment.org/D7578

src/lib/eina/eina_internal.h
src/lib/eina/eina_promise.c
src/lib/eina/eina_promise.h

index 9ae14df..e501bd1 100644 (file)
@@ -42,6 +42,7 @@
 #endif
 
 #include "eina_prefix.h"
+#include "eina_promise.h"
 
 typedef struct _Eina_Vpath_Interface_User Eina_Vpath_Interface_User;
 
@@ -99,7 +100,6 @@ EAPI void eina_vpath_interface_app_set(const char *app_name, Eina_Prefix *p);
  */
 EAPI void eina_vpath_interface_user_set(Eina_Vpath_Interface_User *user);
 
-
 void eina_xdg_env_init(void);
 
 #undef EAPI
index e9d4461..1937c17 100644 (file)
@@ -1096,13 +1096,6 @@ eina_future_cb_convert_to(const Eina_Value_Type *type)
    return (Eina_Future_Desc){.cb = _eina_future_cb_convert_to, .data = type};
 }
 
-EAPI void *
-eina_promise_data_get(const Eina_Promise *p)
-{
-   EINA_SAFETY_ON_NULL_RETURN_VAL(p, NULL);
-   return (void *)p->data;
-}
-
 static Eina_Value
 _eina_future_cb_easy(void *data, const Eina_Value value,
                      const Eina_Future *dead_future)
index 9a148e4..428da12 100644 (file)
@@ -535,7 +535,6 @@ struct _Eina_Future_Desc {
  * @see eina_promise_continue_new()
  * @see eina_promise_resolve()
  * @see eina_promise_reject()
- * @see eina_promise_data_get()
  * @see eina_promise_as_value()
  * @see #Eina_Future_Scheduler
  * @see #Eina_Future_Scheduler_Entry
@@ -602,7 +601,6 @@ EAPI Eina_Promise *eina_promise_new(Eina_Future_Scheduler *scheduler, Eina_Promi
  * @see eina_promise_new()
  * @see eina_promise_resolve()
  * @see eina_promise_reject()
- * @see eina_promise_data_get()
  * @see eina_promise_as_value()
  * @see #Eina_Future_Scheduler
  * @see #Eina_Future_Scheduler_Entry
@@ -611,15 +609,6 @@ EAPI Eina_Promise *eina_promise_new(Eina_Future_Scheduler *scheduler, Eina_Promi
 EAPI Eina_Promise *eina_promise_continue_new(const Eina_Future *dead_future, Eina_Promise_Cancel_Cb cancel_cb, const void *data) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT;
 
 /**
- * Gets the data attached to the promise.
- *
- * @return The data passed to eina_promise_new() or @c NULL on error.
- * @see eina_promise_new()
- * @see eina_promise_data_set()
- */
-EAPI void *eina_promise_data_get(const Eina_Promise *p) EINA_ARG_NONNULL(1);
-
-/**
  * Resolves a promise.
  *
  * This function schedules a resolve event in a
@@ -637,7 +626,6 @@ EAPI void *eina_promise_data_get(const Eina_Promise *p) EINA_ARG_NONNULL(1);
  *
  * @see eina_promise_new()
  * @see eina_promise_reject()
- * @see eina_promise_data_get()
  * @see eina_promise_as_value()
  */
 EAPI void eina_promise_resolve(Eina_Promise *p, Eina_Value value) EINA_ARG_NONNULL(1);
@@ -655,7 +643,6 @@ EAPI void eina_promise_resolve(Eina_Promise *p, Eina_Value value) EINA_ARG_NONNU
  *
  * @see eina_promise_new()
  * @see eina_promise_resolve()
- * @see eina_promise_data_get()
  * @see eina_promise_as_value()
  */
 EAPI void eina_promise_reject(Eina_Promise *p, Eina_Error err) EINA_ARG_NONNULL(1);