eolian: fix a bug that caused wrong comparisons of class and file name
authorDaniel Kolesa <d.kolesa@samsung.com>
Fri, 1 Aug 2014 12:59:46 +0000 (13:59 +0100)
committerDaniel Kolesa <d.kolesa@samsung.com>
Thu, 21 Aug 2014 08:26:03 +0000 (09:26 +0100)
This also renames ecore_poll files to ecore_poller so that the class name matches.

src/Makefile_Ecore.am
src/Makefile_Ecore_Cxx.am
src/lib/ecore/Ecore_Eo.h
src/lib/ecore/Ecore_Legacy.h
src/lib/ecore/ecore_poller.c [moved from src/lib/ecore/ecore_poll.c with 99% similarity]
src/lib/ecore/ecore_poller.eo [moved from src/lib/ecore/ecore_poll.eo with 100% similarity]
src/lib/eolian/eo_parser.c

index 848cc07..c5170e0 100644 (file)
@@ -5,9 +5,9 @@ BUILT_SOURCES += \
                  lib/ecore/ecore_timer.eo.c \
                  lib/ecore/ecore_timer.eo.h \
                  lib/ecore/ecore_timer.eo.legacy.h \
-                 lib/ecore/ecore_poll.eo.c \
-                 lib/ecore/ecore_poll.eo.h \
-                 lib/ecore/ecore_poll.eo.legacy.h \
+                 lib/ecore/ecore_poller.eo.c \
+                 lib/ecore/ecore_poller.eo.h \
+                 lib/ecore/ecore_poller.eo.legacy.h \
                  lib/ecore/ecore_job.eo.c \
                  lib/ecore/ecore_job.eo.h \
                  lib/ecore/ecore_job.eo.legacy.h \
@@ -27,7 +27,7 @@ BUILT_SOURCES += \
 ecoreeolianfilesdir = $(datadir)/eolian/include/ecore-@VMAJ@
 ecoreeolianfiles_DATA = \
               lib/ecore/ecore_timer.eo \
-              lib/ecore/ecore_poll.eo \
+              lib/ecore/ecore_poller.eo \
               lib/ecore/ecore_job.eo \
               lib/ecore/ecore_idler.eo \
               lib/ecore/ecore_idle_enterer.eo \
@@ -50,7 +50,7 @@ lib/ecore/Ecore_Getopt.h
 
 nodist_installed_ecoremainheaders_DATA = \
                                         lib/ecore/ecore_timer.eo.h \
-                                        lib/ecore/ecore_poll.eo.h \
+                                        lib/ecore/ecore_poller.eo.h \
                                         lib/ecore/ecore_job.eo.h \
                                         lib/ecore/ecore_idler.eo.h \
                                         lib/ecore/ecore_idle_enterer.eo.h \
@@ -58,7 +58,7 @@ nodist_installed_ecoremainheaders_DATA = \
                                         lib/ecore/ecore_animator.eo.h \
                                         lib/ecore/ecore_parent.eo.h \
                                         lib/ecore/ecore_timer.eo.legacy.h \
-                                        lib/ecore/ecore_poll.eo.legacy.h \
+                                        lib/ecore/ecore_poller.eo.legacy.h \
                                         lib/ecore/ecore_job.eo.legacy.h \
                                         lib/ecore/ecore_idler.eo.legacy.h \
                                         lib/ecore/ecore_animator.eo.legacy.h
@@ -77,7 +77,7 @@ lib/ecore/ecore_idler.c \
 lib/ecore/ecore_job.c \
 lib/ecore/ecore_main.c \
 lib/ecore/ecore_pipe.c \
-lib/ecore/ecore_poll.c \
+lib/ecore/ecore_poller.c \
 lib/ecore/ecore_time.c \
 lib/ecore/ecore_timer.c \
 lib/ecore/ecore_thread.c \
index 16816aa..5e63415 100644 (file)
@@ -7,7 +7,7 @@ installed_ecorecxxmainheadersdir = $(includedir)/ecore-cxx-@VMAJ@
 dist_installed_ecorecxxmainheaders_DATA = bindings/ecore_cxx/Ecore.hh
 
 generated_ecore_cxx_bindings = \
-lib/ecore/ecore_poll.eo.hh \
+lib/ecore/ecore_poller.eo.hh \
 lib/ecore/ecore_job.eo.hh \
 lib/ecore/ecore_idler.eo.hh \
 lib/ecore/ecore_idle_exiter.eo.hh \
index 70c8ac9..8974a5e 100644 (file)
@@ -11,7 +11,7 @@ extern "C" {
  * @{
  */
 
-#include "ecore_poll.eo.h"
+#include "ecore_poller.eo.h"
 
 /**
  * @}
index 5ef10d5..af05bd3 100644 (file)
@@ -46,7 +46,7 @@ EAPI Ecore_Poller *ecore_poller_add(Ecore_Poller_Type type, int interval, Ecore_
  */
 EAPI void *ecore_poller_del(Ecore_Poller *poller);
 
-#include "ecore_poll.eo.legacy.h"
+#include "ecore_poller.eo.legacy.h"
 
 /**
  * @}
similarity index 99%
rename from src/lib/ecore/ecore_poll.c
rename to src/lib/ecore/ecore_poller.c
index caf194a..fc544e1 100644 (file)
@@ -405,4 +405,4 @@ _ecore_poller_shutdown(void)
      }
 }
 
-#include "ecore_poll.eo.c"
+#include "ecore_poller.eo.c"
index ee07d2f..687dd32 100644 (file)
@@ -135,6 +135,16 @@ get_filename(Eo_Lexer *ls)
    return file;
 }
 
+static Eina_Bool
+compare_class_file(const char *fn_ext, const char *fn_noext)
+{
+   int fnlen = strlen(fn_ext);
+   int cnlen = strlen(fn_noext);
+   if (cnlen != (fnlen - 3))
+     return EINA_FALSE;
+   return !strncmp(fn_noext, fn_ext, cnlen);
+}
+
 static void
 redef_error(Eo_Lexer *ls, Eolian_Type_Type type, Eolian_Type *old)
 {
@@ -450,7 +460,7 @@ parse_type_struct_void(Eo_Lexer *ls, Eina_Bool allow_struct)
              nm = eina_strbuf_string_get(buf);
              bnm = get_filename(ls);
              fnm = database_class_to_filename(nm);
-             if (strncmp(bnm, fnm, strlen(bnm) - 3))
+             if (!compare_class_file(bnm, fnm))
                {
                   const char *fname = eina_hash_find(_filenames, fnm);
                   eina_stringshare_del(bnm);
@@ -1189,7 +1199,7 @@ parse_class(Eo_Lexer *ls, Eina_Bool allow_ctors, Eolian_Class_Type type)
    parse_name(ls, buf);
    bnm = get_filename(ls);
    fnm = database_class_to_filename(eina_strbuf_string_get(buf));
-   same = !strncmp(bnm, fnm, strlen(bnm) - 3);
+   same = compare_class_file(bnm, fnm);
    eina_stringshare_del(bnm);
    free(fnm);
    if (!same)