Fix minor mem leak in test case
[platform/upstream/glib.git] / gio / gbufferedinputstream.c
index 2013118..3b147d4 100644 (file)
@@ -14,9 +14,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  *
  * Author: Christian Kellner <gicmo@gnome.org>
  */
@@ -129,13 +127,12 @@ static gboolean g_buffered_input_stream_truncate            (GSeekable       *se
                                                             GCancellable    *cancellable,
                                                             GError         **error);
 
-static void     g_buffered_input_stream_finalize            (GObject         *object);
-
 static void compact_buffer (GBufferedInputStream *stream);
 
 G_DEFINE_TYPE_WITH_CODE (GBufferedInputStream,
                         g_buffered_input_stream,
                         G_TYPE_FILTER_INPUT_STREAM,
+                         G_ADD_PRIVATE (GBufferedInputStream)
                         G_IMPLEMENT_INTERFACE (G_TYPE_SEEKABLE,
                                                g_buffered_input_stream_seekable_iface_init))
 
@@ -146,8 +143,6 @@ g_buffered_input_stream_class_init (GBufferedInputStreamClass *klass)
   GInputStreamClass *istream_class;
   GBufferedInputStreamClass *bstream_class;
 
-  g_type_class_add_private (klass, sizeof (GBufferedInputStreamPrivate));
-
   object_class = G_OBJECT_CLASS (klass);
   object_class->get_property = g_buffered_input_stream_get_property;
   object_class->set_property = g_buffered_input_stream_set_property;
@@ -317,9 +312,7 @@ g_buffered_input_stream_seekable_iface_init (GSeekableIface *iface)
 static void
 g_buffered_input_stream_init (GBufferedInputStream *stream)
 {
-  stream->priv = G_TYPE_INSTANCE_GET_PRIVATE (stream,
-                                              G_TYPE_BUFFERED_INPUT_STREAM,
-                                              GBufferedInputStreamPrivate);
+  stream->priv = g_buffered_input_stream_get_instance_private (stream);
 }
 
 
@@ -461,8 +454,7 @@ async_fill_callback_wrapper (GObject      *source_object,
  * g_buffered_input_stream_fill_async:
  * @stream: a #GBufferedInputStream
  * @count: the number of bytes that will be read from the stream
- * @io_priority: the <link linkend="io-priority">I/O priority</link>
- *     of the request
+ * @io_priority: the [I/O priority][io-priority] of the request
  * @cancellable: (allow-none): optional #GCancellable object
  * @callback: (scope async): a #GAsyncReadyCallback
  * @user_data: (closure): a #gpointer
@@ -644,7 +636,7 @@ compact_buffer (GBufferedInputStream *stream)
 
   current_size = priv->end - priv->pos;
 
-  g_memmove (priv->buffer, priv->buffer + priv->pos, current_size);
+  memmove (priv->buffer, priv->buffer + priv->pos, current_size);
 
   priv->pos = 0;
   priv->end = current_size;