[glib/wip/mapped-bytes: 1/4] gbytes: Store NULL for data size 0



commit a0bac3d8be14ce56c79bed1eccafd8495f8ebf1a
Author: Christian Persch <chpe gnome org>
Date:   Wed Feb 15 18:06:38 2012 +0100

    gbytes: Store NULL for data size 0
    
    When the size of the data is 0, store NULL for the data in GBytes. This
    makes GBytes behaviour compatible with the documented behaviour of GMappedFile.

 glib/gbytes.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/glib/gbytes.c b/glib/gbytes.c
index daf5642..16a04f5 100644
--- a/glib/gbytes.c
+++ b/glib/gbytes.c
@@ -171,7 +171,7 @@ g_bytes_new_with_free_func (gconstpointer  data,
   GBytes *bytes;
 
   bytes = g_slice_new (GBytes);
-  bytes->data = data;
+  bytes->data = size ? data : NULL;
   bytes->size = size;
   bytes->free_func = free_func;
   bytes->user_data = user_data;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]