q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=653e258eec564f4175bbf1c30bb687d27959ea83

commit 653e258eec564f4175bbf1c30bb687d27959ea83
Author: Daniel Kolesa <d.kol...@osg.samsung.com>
Date:   Mon Oct 12 11:45:38 2015 +0100

    eolian generator: cleaner file write
---
 src/bin/eolian/main.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c
index 61b2da6..c213a5c 100644
--- a/src/bin/eolian/main.c
+++ b/src/bin/eolian/main.c
@@ -94,9 +94,7 @@ _read_file(char *filename, Eina_Strbuf **buf)
 static Eina_Bool
 _write_file(char *filename, const Eina_Strbuf *buffer, Eina_Bool append)
 {
-   const char *data = eina_strbuf_string_get(buffer);
-
-   FILE* fd = fopen(filename, append ? "ab" : "wb");
+   FILE *fd = fopen(filename, append ? "ab" : "wb");
    if (!fd)
      {
         fprintf(stderr, "eolian: could not open '%s' for writing (%s)\n",
@@ -104,7 +102,8 @@ _write_file(char *filename, const Eina_Strbuf *buffer, 
Eina_Bool append)
         return EINA_FALSE;
      }
 
-   if (data) fputs(data, fd);
+   if (eina_strbuf_length_get(buffer))
+     fwrite(eina_strbuf_string_get(buffer), 1, eina_strbuf_length_get(buffer), 
fd);
    fclose(fd);
    return EINA_TRUE;
 }

-- 


Reply via email to