diff options
author | Daniel Zaoui <daniel.zaoui@samsung.com> | 2014-05-02 19:20:10 +0300 |
---|---|---|
committer | Daniel Zaoui <daniel.zaoui@samsung.com> | 2014-05-26 13:56:06 +0300 |
commit | 04cc8138137e7ba936288ac6b084b569f72514b8 (patch) | |
tree | c39f4e81dcd95f9d95efbb656ff2665e920fd8b5 /src/bin/eolian | |
parent | a541aecf766a3ac4c0e49316b589fa860a743298 (diff) | |
download | efl-04cc8138137e7ba936288ac6b084b569f72514b8.tar.gz |
Eolian: add test for generator.
The test checks the dev code generator.
Diffstat (limited to 'src/bin/eolian')
-rw-r--r-- | src/bin/eolian/main.c | 36 |
1 files changed, 18 insertions, 18 deletions
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)) { |