eolian_gen: void out keys depending on how they are setted
authorMarcel Hollerbach <mail@marcel-hollerbach.de>
Tue, 15 Jan 2019 17:13:43 +0000 (18:13 +0100)
committerJunsuChoi <jsuya.choi@samsung.com>
Thu, 24 Jan 2019 05:20:17 +0000 (14:20 +0900)
this avoid warings about keys not beeing used in the fallback function.

Reviewed-by: Daniel Kolesa <daniel@octaforge.org>
Differential Revision: https://phab.enlightenment.org/D7630

src/bin/eolian/sources.c

index 900b702..d80ca74 100644 (file)
@@ -267,6 +267,50 @@ _generate_iterative_free(Eina_Strbuf **buf, const Eolian_Type *type, const Eolia
    eina_strbuf_free(iter_param);
 }
 
+static int
+_gen_function_param_fallback(Eina_Iterator *itr, Eina_Strbuf *fallback_free_ownership, Eina_Strbuf *param_call)
+{
+   Eolian_Function_Parameter *pr;
+   int owners = 0;
+
+   EINA_ITERATOR_FOREACH(itr, pr)
+     {
+        const Eolian_Type *type, *inner_type;
+
+        type = eolian_parameter_type_get(pr);
+        inner_type = eolian_type_base_type_get(type);
+
+        //check if they should be freed or just ignored
+        if (!eolian_type_is_owned(type) || eolian_parameter_direction_get(pr) == EOLIAN_OUT_PARAM)
+          {
+             eina_strbuf_append_printf(fallback_free_ownership, "   (void)%s;\n", eolian_parameter_name_get(pr));
+             continue;
+          }
+
+        owners ++;
+
+        eina_strbuf_reset(param_call);
+
+        if (eolian_parameter_direction_get(pr) == EOLIAN_INOUT_PARAM)
+          eina_strbuf_append_char(param_call, '*');
+        eina_strbuf_append(param_call, eolian_parameter_name_get(pr));
+
+        //check if we might want to free or handle the children
+        if (!inner_type || !eolian_type_is_owned(inner_type))
+          {
+             _generate_normal_free(&fallback_free_ownership, type, param_call, "");
+          }
+        else if (inner_type && eolian_type_is_owned(inner_type))
+          {
+             _generate_iterative_free(&fallback_free_ownership, type, inner_type, pr, param_call);
+          }
+      }
+   eina_iterator_free(itr);
+
+   return owners;
+}
+
+
 static void
 _gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
           Eolian_Function_Type ftype, Eina_Strbuf *buf,
@@ -356,50 +400,23 @@ _gen_func(const Eolian_Class *cl, const Eolian_Function *fid,
    else
      {
           Eina_Iterator *itr;
-          Eolian_Function_Parameter *pr;
           int owners = 0;
           Eina_Strbuf *param_call;
 
           param_call = eina_strbuf_new();
 
           if (is_prop)
-            itr = eolian_property_values_get(fid, ftype);
+            {
+               itr = eolian_property_values_get(fid, ftype);
+               owners += _gen_function_param_fallback(itr, fallback_free_ownership, param_call);
+               itr = eolian_property_keys_get(fid, ftype);
+               owners += _gen_function_param_fallback(itr, fallback_free_ownership, param_call);
+            }
           else
-            itr = eolian_function_parameters_get(fid);
-
-          EINA_ITERATOR_FOREACH(itr, pr)
             {
-               const Eolian_Type *type, *inner_type;
-
-               type = eolian_parameter_type_get(pr);
-               inner_type = eolian_type_base_type_get(type);
-
-               //check if they should be freed or just ignored
-               if (!eolian_type_is_owned(type) || eolian_parameter_direction_get(pr) == EOLIAN_OUT_PARAM)
-                 {
-                    eina_strbuf_append_printf(fallback_free_ownership, "   (void)%s;\n", eolian_parameter_name_get(pr));
-                    continue;
-                 }
-
-               owners ++;
-
-               eina_strbuf_reset(param_call);
-
-               if (eolian_parameter_direction_get(pr) == EOLIAN_INOUT_PARAM)
-                 eina_strbuf_append_char(param_call, '*');
-               eina_strbuf_append(param_call, eolian_parameter_name_get(pr));
-
-               //check if we might want to free or handle the children
-               if (!inner_type || !eolian_type_is_owned(inner_type))
-                 {
-                    _generate_normal_free(&fallback_free_ownership, type, param_call, "");
-                 }
-               else if (inner_type && eolian_type_is_owned(inner_type))
-                 {
-                    _generate_iterative_free(&fallback_free_ownership, type, inner_type, pr, param_call);
-                 }
+               itr = eolian_function_parameters_get(fid);
+               owners += _gen_function_param_fallback(itr, fallback_free_ownership, param_call);
             }
-          eina_iterator_free(itr);
 
           if (owners == 0)
             {