q66 pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=7cf7cba88e221b1d580937ec98c1c469378567a6
commit 7cf7cba88e221b1d580937ec98c1c469378567a6 Author: Daniel Kolesa <[email protected]> Date: Mon Jun 6 15:50:15 2016 +0100 eolian: remove the c_type_named_get APIs These have inconsistent behavior and are generally unnecessary, so I'm removing them. Use the c_type_get funcs instead. --- src/bindings/luajit/eolian.lua | 15 ------------- src/lib/eolian/Eolian.h | 46 ++++---------------------------------- src/lib/eolian/database_type.c | 23 +++++-------------- src/lib/eolian/database_type_api.c | 20 ++++------------- src/lib/eolian/eolian_database.h | 2 +- 5 files changed, 15 insertions(+), 91 deletions(-) diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua index bf55ded..077712c 100644 --- a/src/bindings/luajit/eolian.lua +++ b/src/bindings/luajit/eolian.lua @@ -307,9 +307,6 @@ ffi.cdef [[ Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp); - const char *eolian_type_c_type_named_get(const Eolian_Type *tp, const char *name); - const char *eolian_typedecl_c_type_named_get(const Eolian_Typedecl *tp, const char *name); - const char *eolian_type_c_type_get(const Eolian_Type *tp); const char *eolian_typedecl_c_type_get(const Eolian_Typedecl *tp); @@ -585,12 +582,6 @@ M.Typedecl = ffi.metatype("Eolian_Typedecl", { return eolian.eolian_typedecl_is_extern(self) ~= 0 end, - c_type_named_get = function(self, name) - local v = eolian.eolian_typedecl_c_type_named_get(self, name) - if v == nil then return nil end - return ffi_stringshare(v) - end, - c_type_get = function(self) local v = eolian.eolian_typedecl_c_type_get(self) if v == nil then return nil end @@ -671,12 +662,6 @@ M.Type = ffi.metatype("Eolian_Type", { return eolian.eolian_type_is_const(self) ~= 0 end, - c_type_named_get = function(self, name) - local v = eolian.eolian_type_c_type_named_get(self, name) - if v == nil then return nil end - return ffi_stringshare(v) - end, - c_type_get = function(self) local v = eolian.eolian_type_c_type_get(self) if v == nil then return nil end diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h index 937ae44..7114274 100644 --- a/src/lib/eolian/Eolian.h +++ b/src/lib/eolian/Eolian.h @@ -1597,33 +1597,13 @@ EAPI const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Typedecl * EAPI Eina_Bool eolian_typedecl_is_extern(const Eolian_Typedecl *tp); /* - * @brief Get the full C type name of the given type declaration with a name. + * @brief Get the full C type name of the given type. * * @param[in] tp the type declaration. - * @param[in] name the name. * @return The C type name assuming @c tp is not NULL. * - * Name is ignored for alias types and they're turned into C typedefs. - * - * Keep in mind that if @c name is NULL, the name won't be included. - * Also, you're responsible for deleting the stringshare. - * - * @see eolian_typedecl_c_type_get - * @see eolian_type_c_type_named_get - * - * @ingroup Eolian - */ -EAPI Eina_Stringshare *eolian_typedecl_c_type_named_get(const Eolian_Typedecl *tp, const char *name); - -/* - * @brief Get the full C type name of the given type without a name. - * - * @param[in] tp the type declaration. - * @return The C type name assuming @c tp is not NULL. - * - * This behaves exactly like eolian_typedecl_c_type_named_get when name is NULL. + * You're responsible for deleting the stringshare. * - * @see eolian_typedecl_c_type_named_get * @see eolian_type_c_type_get * * @ingroup Eolian @@ -1770,31 +1750,13 @@ EAPI Eina_Bool eolian_type_is_own(const Eolian_Type *tp); EAPI Eina_Bool eolian_type_is_const(const Eolian_Type *tp); /* - * @brief Get the full C type name of the given type with a name. - * - * @param[in] tp the type. - * @param[in] name the name. - * @return The C type name assuming @c tp is not NULL. - * - * Keep in mind that if @c name is NULL, the name won't be included. - * Also, you're responsible for deleting the stringshare. - * - * @see eolian_type_c_type_get - * @see eolian_typedecl_c_type_named_get - * - * @ingroup Eolian - */ -EAPI Eina_Stringshare *eolian_type_c_type_named_get(const Eolian_Type *tp, const char *name); - -/* - * @brief Get the full C type name of the given type without a name. + * @brief Get the full C type name of the given type. * * @param[in] tp the type. * @return The C type name assuming @c tp is not NULL. * - * This behaves exactly like eolian_type_c_type_named_get when name is NULL. + * You're responsible for the stringshare. * - * @see eolian_type_c_type_named_get * @see eolian_typedecl_c_type_get * * @ingroup Eolian diff --git a/src/lib/eolian/database_type.c b/src/lib/eolian/database_type.c index 092f2f7..c630262 100644 --- a/src/lib/eolian/database_type.c +++ b/src/lib/eolian/database_type.c @@ -127,7 +127,7 @@ database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name, } static void -_stype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf, const char *name) +_stype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf) { Eolian_Struct_Type_Field *sf; Eina_List *l; @@ -145,7 +145,7 @@ _stype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf, const char *name) eina_strbuf_append_char(buf, ' '); } if (tp->type == EOLIAN_TYPEDECL_STRUCT_OPAQUE) - goto append_name; + return; eina_strbuf_append(buf, "{ "); EINA_LIST_FOREACH(tp->field_list, l, sf) { @@ -153,16 +153,10 @@ _stype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf, const char *name) eina_strbuf_append(buf, "; "); } eina_strbuf_append(buf, "}"); -append_name: - if (name) - { - eina_strbuf_append_char(buf, ' '); - eina_strbuf_append(buf, name); - } } static void -_etype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf, const char *name) +_etype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf) { Eolian_Enum_Type_Field *ef; Eina_List *l; @@ -197,11 +191,6 @@ _etype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf, const char *name) eina_strbuf_append(buf, ", "); } eina_strbuf_append(buf, " }"); - if (name) - { - eina_strbuf_append_char(buf, ' '); - eina_strbuf_append(buf, name); - } } static void @@ -239,7 +228,7 @@ _atype_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf) } void -database_typedecl_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf, const char *name) +database_typedecl_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf) { switch (tp->type) { @@ -247,11 +236,11 @@ database_typedecl_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf, const char _atype_to_str(tp, buf); break; case EOLIAN_TYPEDECL_ENUM: - _etype_to_str(tp, buf, name); + _etype_to_str(tp, buf); break; case EOLIAN_TYPEDECL_STRUCT: case EOLIAN_TYPEDECL_STRUCT_OPAQUE: - _stype_to_str(tp, buf, name); + _stype_to_str(tp, buf); break; default: break; diff --git a/src/lib/eolian/database_type_api.c b/src/lib/eolian/database_type_api.c index 2aa55e4..268ca8e 100644 --- a/src/lib/eolian/database_type_api.c +++ b/src/lib/eolian/database_type_api.c @@ -346,44 +346,32 @@ eolian_typedecl_is_extern(const Eolian_Typedecl *tp) } EAPI Eina_Stringshare * -eolian_type_c_type_named_get(const Eolian_Type *tp, const char *name) +eolian_type_c_type_get(const Eolian_Type *tp) { Eina_Stringshare *ret; Eina_Strbuf *buf; EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL); buf = eina_strbuf_new(); - database_type_to_str(tp, buf, name, EINA_FALSE); + database_type_to_str(tp, buf, NULL, EINA_FALSE); ret = eina_stringshare_add(eina_strbuf_string_get(buf)); eina_strbuf_free(buf); return ret; } EAPI Eina_Stringshare * -eolian_typedecl_c_type_named_get(const Eolian_Typedecl *tp, const char *name) +eolian_typedecl_c_type_get(const Eolian_Typedecl *tp) { Eina_Stringshare *ret; Eina_Strbuf *buf; EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL); buf = eina_strbuf_new(); - database_typedecl_to_str(tp, buf, name); + database_typedecl_to_str(tp, buf); ret = eina_stringshare_add(eina_strbuf_string_get(buf)); eina_strbuf_free(buf); return ret; } EAPI Eina_Stringshare * -eolian_type_c_type_get(const Eolian_Type *tp) -{ - return eolian_type_c_type_named_get(tp, NULL); -} - -EAPI Eina_Stringshare * -eolian_typedecl_c_type_get(const Eolian_Typedecl *tp) -{ - return eolian_typedecl_c_type_named_get(tp, NULL); -} - -EAPI Eina_Stringshare * eolian_type_name_get(const Eolian_Type *tp) { EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL); diff --git a/src/lib/eolian/eolian_database.h b/src/lib/eolian/eolian_database.h index b2cd78d..7b20e92 100644 --- a/src/lib/eolian/eolian_database.h +++ b/src/lib/eolian/eolian_database.h @@ -302,7 +302,7 @@ void database_type_del(Eolian_Type *tp); void database_typedecl_del(Eolian_Typedecl *tp); void database_type_to_str(const Eolian_Type *tp, Eina_Strbuf *buf, const char *name, Eina_Bool is_ref); -void database_typedecl_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf, const char *name); +void database_typedecl_to_str(const Eolian_Typedecl *tp, Eina_Strbuf *buf); /* expressions */ --
