jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=9b667ed06292bc4dfe4e67a69788f5961893a9bf

commit 9b667ed06292bc4dfe4e67a69788f5961893a9bf
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Wed Jul 5 20:12:14 2017 +0900

    elm: Forbid calls to efl_part(obj, NULL)
    
    This in theory should only affect the EO API usage. In EO
    we don't want efl_part() to be used for NULL part. In other
    words, there is no "default" part in EO objects. Instead, those
    functions like text_set or content_set should simply be
    implemented by the object themselves.
    
    The legacy API on the other hand will make sure that the
    "part" argument is set to a non-NULL value before reaching
    this point.
---
 src/lib/elementary/elm_layout.c      | 2 +-
 src/lib/elementary/elm_part_helper.h | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/lib/elementary/elm_layout.c b/src/lib/elementary/elm_layout.c
index 5353a7c745..1f7e929a24 100644
--- a/src/lib/elementary/elm_layout.c
+++ b/src/lib/elementary/elm_layout.c
@@ -2381,7 +2381,7 @@ _elm_layout_efl_part_part(const Eo *obj, 
Elm_Layout_Smart_Data *sd EINA_UNUSED,
      {
         pd->obj = (Eo *) obj;
         pd->sd = efl_data_xref(pd->obj, ELM_LAYOUT_CLASS, proxy);
-        pd->part = part ? strdup(part) : NULL;
+        pd->part = strdup(part);
         pd->temp = 1;
      }
 
diff --git a/src/lib/elementary/elm_part_helper.h 
b/src/lib/elementary/elm_part_helper.h
index 55c50f33aa..3f4ae43f76 100644
--- a/src/lib/elementary/elm_part_helper.h
+++ b/src/lib/elementary/elm_part_helper.h
@@ -43,13 +43,14 @@ _ ## type ## _efl_part_part(const Eo *obj, typedata *priv 
EINA_UNUSED, const cha
    partdata *pd; \
    Eo *proxy; \
 \
+   EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL); \
    proxy = efl_add(TYPE ## _INTERNAL_PART_CLASS, (Eo *) obj); \
    pd = efl_data_scope_get(proxy, TYPE ## _INTERNAL_PART_CLASS); \
    if (pd) \
      { \
         pd->obj = (Eo *) obj; \
         pd->sd = efl_data_xref(pd->obj, TYPE ## _CLASS, proxy); \
-        pd->part = part ? strdup(part) : NULL; \
+        pd->part = strdup(part); \
         pd->temp = 1; \
      } \
 \
@@ -111,13 +112,14 @@ _ ## type ## _efl_part_part(const Eo *obj, typedata *priv 
EINA_UNUSED, const cha
    partdata *pd; \
    Eo *proxy; \
 \
+   EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL); \
    proxy = efl_add(TYPE ## _INTERNAL_PART_CLASS, (Eo *) obj); \
    pd = efl_data_scope_get(proxy, SUPER ## _INTERNAL_PART_CLASS); \
    if (pd) \
      { \
         pd->obj = (Eo *) obj; \
         pd->sd = efl_data_xref(pd->obj, SUPER ## _CLASS, proxy); \
-        pd->part = part ? strdup(part) : NULL; \
+        pd->part = strdup(part); \
         pd->temp = 1; \
      } \
 \

-- 


Reply via email to