From 04cc8138137e7ba936288ac6b084b569f72514b8 Mon Sep 17 00:00:00 2001 From: Daniel Zaoui Date: Fri, 2 May 2014 19:20:10 +0300 Subject: Eolian: add test for generator. The test checks the dev code generator. --- src/bin/eolian/main.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/bin/eolian') diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c index 576d18cf5f..8ceb3cf16f 100644 --- a/src/bin/eolian/main.c +++ b/src/bin/eolian/main.c @@ -124,29 +124,29 @@ _generate_impl_c_file(char *filename, const char *classname) { Eina_Bool ret = EINA_FALSE; long file_size = 0; + Eina_Strbuf *buffer = NULL; FILE* fd = fopen(filename, "rb"); - if (!fd) + if (fd) { - ERR("Couldnt open file %s for reading", filename); - goto end; - } - - fseek(fd, 0, SEEK_END); - file_size = ftell(fd); - fseek(fd, 0, SEEK_SET); - char *content = malloc(file_size + 1); - fread(content, file_size, 1, fd); - content[file_size] = '\0'; - fclose(fd); + fseek(fd, 0, SEEK_END); + file_size = ftell(fd); + fseek(fd, 0, SEEK_SET); + char *content = malloc(file_size + 1); + fread(content, file_size, 1, fd); + content[file_size] = '\0'; + fclose(fd); + + if (!content) + { + ERR("Couldnt read file %s", filename); + goto end; + } - if (!content) - { - ERR("Couldnt read file %s", filename); - goto end; + buffer = eina_strbuf_manage_new(content); } - - Eina_Strbuf *buffer = eina_strbuf_manage_new(content); + else + buffer = eina_strbuf_new(); if (!impl_source_generate(classname, buffer)) { -- cgit v1.2.1