SF.net SVN: geany-plugins:[1568] trunk/geany-plugins/geanygendoc/src/ggd.c

colombanw at users.sourceforge.net colombanw at xxxxx
Thu Sep 9 16:19:56 UTC 2010


Revision: 1568
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=1568&view=rev
Author:   colombanw
Date:     2010-09-09 16:19:56 +0000 (Thu, 09 Sep 2010)

Log Message:
-----------
Fix a little the usage of CtplOutputStream

Don't assume it's an alias to GOutputStream, and use the correct CTPL
functions to build that stream -- no matter I know it's currently only
a ref.
Also don't leak the stream around if parsing fails.

Modified Paths:
--------------
    trunk/geany-plugins/geanygendoc/src/ggd.c

Modified: trunk/geany-plugins/geanygendoc/src/ggd.c
===================================================================
--- trunk/geany-plugins/geanygendoc/src/ggd.c	2010-09-08 13:13:28 UTC (rev 1567)
+++ trunk/geany-plugins/geanygendoc/src/ggd.c	2010-09-09 16:19:56 UTC (rev 1568)
@@ -54,12 +54,14 @@
                         CtplEnviron     *env,
                         GError         **error)
 {
-  GOutputStream  *ostream;
-  gchar          *output = NULL;
+  GOutputStream    *gostream;
+  CtplOutputStream *ostream;
+  gchar            *output = NULL;
   
-  ostream = g_memory_output_stream_new (NULL, 0, g_try_realloc, NULL);
+  gostream = g_memory_output_stream_new (NULL, 0, g_try_realloc, NULL);
+  ostream = ctpl_output_stream_new (gostream);
   if (ctpl_parser_parse (tree, env, ostream, error)) {
-    GMemoryOutputStream  *memostream = G_MEMORY_OUTPUT_STREAM (ostream);
+    GMemoryOutputStream  *memostream = G_MEMORY_OUTPUT_STREAM (gostream);
     gsize                 size;
     gsize                 data_size;
     
@@ -84,8 +86,9 @@
     if (size > data_size) {
       output[data_size] = 0;
     }
-    g_object_unref (ostream);
   }
+  ctpl_output_stream_unref (ostream);
+  g_object_unref (gostream);
   
   return output;
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Plugins-Commits mailing list