q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=5f32c178e94a9f932d4628cb6d98cd939235bc40

commit 5f32c178e94a9f932d4628cb6d98cd939235bc40
Author: Daniel Kolesa <d.kol...@osg.samsung.com>
Date:   Tue May 12 14:27:02 2015 +0100

    eolian: update eolian_type_base_type_get for REGULAR types
---
 src/lib/eolian/Eolian.h            |  5 ++++-
 src/lib/eolian/database_type_api.c | 18 +++++++++++++++++-
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index 77b26b0..af2d575 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -1619,7 +1619,10 @@ EAPI Eina_Stringshare *eolian_type_description_get(const 
Eolian_Type *tp);
 EAPI Eina_Stringshare *eolian_type_file_get(const Eolian_Type *tp);
 
 /*
- * @brief Get the base type of a pointer or alias type.
+ * @brief Get the base type of a pointer, alias or regular type.
+ *
+ * For pointers and aliases, it's a simple lookup. For regular types, it
+ * tries to look up alias, struct and enum in that order.
  *
  * @param[in] tp the type.
  * @return the base type when @c tp is a pointer or alias, NULL otherwise.
diff --git a/src/lib/eolian/database_type_api.c 
b/src/lib/eolian/database_type_api.c
index b755471..8f95590 100644
--- a/src/lib/eolian/database_type_api.c
+++ b/src/lib/eolian/database_type_api.c
@@ -204,7 +204,23 @@ eolian_type_base_type_get(const Eolian_Type *tp)
    Eolian_Type_Type tpt;
    EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
    tpt = eolian_type_type_get(tp);
-   EINA_SAFETY_ON_FALSE_RETURN_VAL(tpt == EOLIAN_TYPE_POINTER || tpt == 
EOLIAN_TYPE_ALIAS, NULL);
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(tpt == EOLIAN_TYPE_POINTER
+                                || tpt == EOLIAN_TYPE_ALIAS
+                                || tpt == EOLIAN_TYPE_REGULAR, NULL);
+   if (tpt == EOLIAN_TYPE_REGULAR)
+     {
+        /* for regular types, try looking up if it belongs to a struct,
+         * enum or an alias... otherwise return NULL
+         */
+       Eolian_Type *rtp;
+       rtp = eina_hash_find(_aliases, tp->full_name);
+       if (rtp) return rtp;
+       rtp = eina_hash_find(_structs, tp->full_name);
+       if (rtp) return rtp;
+       rtp = eina_hash_find(_enums, tp->full_name);
+       if (rtp) return rtp;
+       return NULL;
+     }
    return tp->base_type;
 }
 

-- 


Reply via email to