use g_mem_chunk_alloc0() to allocate the memchunk, so the correct size of
authorTim Janik <timj@gtk.org>
Sat, 5 Sep 1998 06:53:43 +0000 (06:53 +0000)
committerTim Janik <timj@src.gnome.org>
Sat, 5 Sep 1998 06:53:43 +0000 (06:53 +0000)
Sat Sep  5 04:40:02 1998  Tim Janik  <timj@gtk.org>

        * glib.h:
        (g_chunk_new0): use g_mem_chunk_alloc0() to allocate the memchunk,
        so the correct size of the memchunk is allocated with 0's and not
        a memory portion of the size of the desired type.

        * gmem.c: new function g_mem_chunk_alloc0() which will initialize
        a memory area allocated with g_mem_chunk_alloc() with 0's.

12 files changed:
ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
glib.h
glib/glib.h
glib/gmem.c
gmem.c

index 9cdfbfbaa97408be21e02e7621b6ea79fbd6b153..635d56772537d7b44975c472e9d7ab9b9316d19f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,16 @@
+Sat Sep  5 04:40:02 1998  Tim Janik  <timj@gtk.org>
+
+       * glib.h: 
+       (g_chunk_new0): use g_mem_chunk_alloc0() to allocate the memchunk,
+       so the correct size of the memchunk is allocated with 0's and not
+       a memory portion of the size of the desired type.
+
+       * gmem.c: new function g_mem_chunk_alloc0() which will initialize
+       a memory area allocated with g_mem_chunk_alloc() with 0's.
+
 Wed Sep  2 19:13:28 1998  Owen Taylor  <otaylor@redhat.com>
 
-       * garray.c glib.h (g_array_[ap/pr]epend_vals): make
+       * garray.c glib.h (g_array_[ap/pre]pend_vals): make
        data argument const.
 
 Wed Aug 26 06:32:40 1998  Tim Janik  <timj@gtk.org>
index 9cdfbfbaa97408be21e02e7621b6ea79fbd6b153..635d56772537d7b44975c472e9d7ab9b9316d19f 100644 (file)
@@ -1,6 +1,16 @@
+Sat Sep  5 04:40:02 1998  Tim Janik  <timj@gtk.org>
+
+       * glib.h: 
+       (g_chunk_new0): use g_mem_chunk_alloc0() to allocate the memchunk,
+       so the correct size of the memchunk is allocated with 0's and not
+       a memory portion of the size of the desired type.
+
+       * gmem.c: new function g_mem_chunk_alloc0() which will initialize
+       a memory area allocated with g_mem_chunk_alloc() with 0's.
+
 Wed Sep  2 19:13:28 1998  Owen Taylor  <otaylor@redhat.com>
 
-       * garray.c glib.h (g_array_[ap/pr]epend_vals): make
+       * garray.c glib.h (g_array_[ap/pre]pend_vals): make
        data argument const.
 
 Wed Aug 26 06:32:40 1998  Tim Janik  <timj@gtk.org>
index 9cdfbfbaa97408be21e02e7621b6ea79fbd6b153..635d56772537d7b44975c472e9d7ab9b9316d19f 100644 (file)
@@ -1,6 +1,16 @@
+Sat Sep  5 04:40:02 1998  Tim Janik  <timj@gtk.org>
+
+       * glib.h: 
+       (g_chunk_new0): use g_mem_chunk_alloc0() to allocate the memchunk,
+       so the correct size of the memchunk is allocated with 0's and not
+       a memory portion of the size of the desired type.
+
+       * gmem.c: new function g_mem_chunk_alloc0() which will initialize
+       a memory area allocated with g_mem_chunk_alloc() with 0's.
+
 Wed Sep  2 19:13:28 1998  Owen Taylor  <otaylor@redhat.com>
 
-       * garray.c glib.h (g_array_[ap/pr]epend_vals): make
+       * garray.c glib.h (g_array_[ap/pre]pend_vals): make
        data argument const.
 
 Wed Aug 26 06:32:40 1998  Tim Janik  <timj@gtk.org>
index 9cdfbfbaa97408be21e02e7621b6ea79fbd6b153..635d56772537d7b44975c472e9d7ab9b9316d19f 100644 (file)
@@ -1,6 +1,16 @@
+Sat Sep  5 04:40:02 1998  Tim Janik  <timj@gtk.org>
+
+       * glib.h: 
+       (g_chunk_new0): use g_mem_chunk_alloc0() to allocate the memchunk,
+       so the correct size of the memchunk is allocated with 0's and not
+       a memory portion of the size of the desired type.
+
+       * gmem.c: new function g_mem_chunk_alloc0() which will initialize
+       a memory area allocated with g_mem_chunk_alloc() with 0's.
+
 Wed Sep  2 19:13:28 1998  Owen Taylor  <otaylor@redhat.com>
 
-       * garray.c glib.h (g_array_[ap/pr]epend_vals): make
+       * garray.c glib.h (g_array_[ap/pre]pend_vals): make
        data argument const.
 
 Wed Aug 26 06:32:40 1998  Tim Janik  <timj@gtk.org>
index 9cdfbfbaa97408be21e02e7621b6ea79fbd6b153..635d56772537d7b44975c472e9d7ab9b9316d19f 100644 (file)
@@ -1,6 +1,16 @@
+Sat Sep  5 04:40:02 1998  Tim Janik  <timj@gtk.org>
+
+       * glib.h: 
+       (g_chunk_new0): use g_mem_chunk_alloc0() to allocate the memchunk,
+       so the correct size of the memchunk is allocated with 0's and not
+       a memory portion of the size of the desired type.
+
+       * gmem.c: new function g_mem_chunk_alloc0() which will initialize
+       a memory area allocated with g_mem_chunk_alloc() with 0's.
+
 Wed Sep  2 19:13:28 1998  Owen Taylor  <otaylor@redhat.com>
 
-       * garray.c glib.h (g_array_[ap/pr]epend_vals): make
+       * garray.c glib.h (g_array_[ap/pre]pend_vals): make
        data argument const.
 
 Wed Aug 26 06:32:40 1998  Tim Janik  <timj@gtk.org>
index 9cdfbfbaa97408be21e02e7621b6ea79fbd6b153..635d56772537d7b44975c472e9d7ab9b9316d19f 100644 (file)
@@ -1,6 +1,16 @@
+Sat Sep  5 04:40:02 1998  Tim Janik  <timj@gtk.org>
+
+       * glib.h: 
+       (g_chunk_new0): use g_mem_chunk_alloc0() to allocate the memchunk,
+       so the correct size of the memchunk is allocated with 0's and not
+       a memory portion of the size of the desired type.
+
+       * gmem.c: new function g_mem_chunk_alloc0() which will initialize
+       a memory area allocated with g_mem_chunk_alloc() with 0's.
+
 Wed Sep  2 19:13:28 1998  Owen Taylor  <otaylor@redhat.com>
 
-       * garray.c glib.h (g_array_[ap/pr]epend_vals): make
+       * garray.c glib.h (g_array_[ap/pre]pend_vals): make
        data argument const.
 
 Wed Aug 26 06:32:40 1998  Tim Janik  <timj@gtk.org>
index 9cdfbfbaa97408be21e02e7621b6ea79fbd6b153..635d56772537d7b44975c472e9d7ab9b9316d19f 100644 (file)
@@ -1,6 +1,16 @@
+Sat Sep  5 04:40:02 1998  Tim Janik  <timj@gtk.org>
+
+       * glib.h: 
+       (g_chunk_new0): use g_mem_chunk_alloc0() to allocate the memchunk,
+       so the correct size of the memchunk is allocated with 0's and not
+       a memory portion of the size of the desired type.
+
+       * gmem.c: new function g_mem_chunk_alloc0() which will initialize
+       a memory area allocated with g_mem_chunk_alloc() with 0's.
+
 Wed Sep  2 19:13:28 1998  Owen Taylor  <otaylor@redhat.com>
 
-       * garray.c glib.h (g_array_[ap/pr]epend_vals): make
+       * garray.c glib.h (g_array_[ap/pre]pend_vals): make
        data argument const.
 
 Wed Aug 26 06:32:40 1998  Tim Janik  <timj@gtk.org>
index 9cdfbfbaa97408be21e02e7621b6ea79fbd6b153..635d56772537d7b44975c472e9d7ab9b9316d19f 100644 (file)
@@ -1,6 +1,16 @@
+Sat Sep  5 04:40:02 1998  Tim Janik  <timj@gtk.org>
+
+       * glib.h: 
+       (g_chunk_new0): use g_mem_chunk_alloc0() to allocate the memchunk,
+       so the correct size of the memchunk is allocated with 0's and not
+       a memory portion of the size of the desired type.
+
+       * gmem.c: new function g_mem_chunk_alloc0() which will initialize
+       a memory area allocated with g_mem_chunk_alloc() with 0's.
+
 Wed Sep  2 19:13:28 1998  Owen Taylor  <otaylor@redhat.com>
 
-       * garray.c glib.h (g_array_[ap/pr]epend_vals): make
+       * garray.c glib.h (g_array_[ap/pre]pend_vals): make
        data argument const.
 
 Wed Aug 26 06:32:40 1998  Tim Janik  <timj@gtk.org>
diff --git a/glib.h b/glib.h
index a7c3df6aeea262c75ecc70ed9730aa0d72808899..64c2943f69b83cea6738686e1fe0c0a20145e9c5 100644 (file)
--- a/glib.h
+++ b/glib.h
   (type *) g_mem_chunk_alloc (chunk) \
 )
 #define g_chunk_new0(type, chunk)      ( \
-  (type *) memset (g_mem_chunk_alloc (chunk), 0, sizeof (type)) \
+  (type *) g_mem_chunk_alloc0 (chunk) \
 )
 #define g_chunk_free(mem, mem_chunk)   G_STMT_START { \
   g_mem_chunk_free ((mem_chunk), (mem)); \
@@ -1087,6 +1087,7 @@ GMemChunk* g_mem_chunk_new     (gchar       *name,
                                gint       type);
 void      g_mem_chunk_destroy (GMemChunk *mem_chunk);
 gpointer   g_mem_chunk_alloc   (GMemChunk *mem_chunk);
+gpointer   g_mem_chunk_alloc0  (GMemChunk *mem_chunk);
 void      g_mem_chunk_free    (GMemChunk *mem_chunk,
                                gpointer   mem);
 void      g_mem_chunk_clean   (GMemChunk *mem_chunk);
index a7c3df6aeea262c75ecc70ed9730aa0d72808899..64c2943f69b83cea6738686e1fe0c0a20145e9c5 100644 (file)
   (type *) g_mem_chunk_alloc (chunk) \
 )
 #define g_chunk_new0(type, chunk)      ( \
-  (type *) memset (g_mem_chunk_alloc (chunk), 0, sizeof (type)) \
+  (type *) g_mem_chunk_alloc0 (chunk) \
 )
 #define g_chunk_free(mem, mem_chunk)   G_STMT_START { \
   g_mem_chunk_free ((mem_chunk), (mem)); \
@@ -1087,6 +1087,7 @@ GMemChunk* g_mem_chunk_new     (gchar       *name,
                                gint       type);
 void      g_mem_chunk_destroy (GMemChunk *mem_chunk);
 gpointer   g_mem_chunk_alloc   (GMemChunk *mem_chunk);
+gpointer   g_mem_chunk_alloc0  (GMemChunk *mem_chunk);
 void      g_mem_chunk_free    (GMemChunk *mem_chunk,
                                gpointer   mem);
 void      g_mem_chunk_clean   (GMemChunk *mem_chunk);
index c662ae7105a3f89064f506719c893e4777297dcc..70444a840dfe00e7bcc660e3895098ee31f75501 100644 (file)
@@ -617,6 +617,22 @@ outa_here:
   return mem;
 }
 
+gpointer
+g_mem_chunk_alloc0 (GMemChunk *mem_chunk)
+{
+  gpointer mem;
+
+  mem = g_mem_chunk_alloc (mem_chunk);
+  if (mem)
+    {
+      GRealMemChunk *rmem_chunk = (GRealMemChunk*) mem_chunk;
+
+      memset (mem, 0, rmem_chunk->atom_size);
+    }
+
+  return mem;
+}
+
 void
 g_mem_chunk_free (GMemChunk *mem_chunk,
                  gpointer   mem)
diff --git a/gmem.c b/gmem.c
index c662ae7105a3f89064f506719c893e4777297dcc..70444a840dfe00e7bcc660e3895098ee31f75501 100644 (file)
--- a/gmem.c
+++ b/gmem.c
@@ -617,6 +617,22 @@ outa_here:
   return mem;
 }
 
+gpointer
+g_mem_chunk_alloc0 (GMemChunk *mem_chunk)
+{
+  gpointer mem;
+
+  mem = g_mem_chunk_alloc (mem_chunk);
+  if (mem)
+    {
+      GRealMemChunk *rmem_chunk = (GRealMemChunk*) mem_chunk;
+
+      memset (mem, 0, rmem_chunk->atom_size);
+    }
+
+  return mem;
+}
+
 void
 g_mem_chunk_free (GMemChunk *mem_chunk,
                  gpointer   mem)