diff mbox

[2/7] Correct libvtv obstack use

Message ID 20151107080801.GC17177@bubble.grove.modra.org
State New
Headers show

Commit Message

Alan Modra Nov. 7, 2015, 8:08 a.m. UTC
Fixes a compile error with both old and new obstacks due to
obstack_chunk_free having the wrong signature.  Also, setting chunk
size and alignment before obstack_init is pointless since they are
overwritten.

	* vtv_malloc.cc (obstack_chunk_free): Correct param type.
	(__vtv_malloc_init): Use obstack_specify_allocation.

Comments

Jeff Law Nov. 8, 2015, 11:20 p.m. UTC | #1
On 11/07/2015 01:08 AM, Alan Modra wrote:
> Fixes a compile error with both old and new obstacks due to
> obstack_chunk_free having the wrong signature.  Also, setting chunk
> size and alignment before obstack_init is pointless since they are
> overwritten.
>
> 	* vtv_malloc.cc (obstack_chunk_free): Correct param type.
> 	(__vtv_malloc_init): Use obstack_specify_allocation.
OK
jeff
diff mbox

Patch

diff --git a/libvtv/vtv_malloc.cc b/libvtv/vtv_malloc.cc
index ecd07eb..ea26b82 100644
--- a/libvtv/vtv_malloc.cc
+++ b/libvtv/vtv_malloc.cc
@@ -194,7 +194,7 @@  obstack_chunk_alloc (size_t size)
 }
 
 static void
-obstack_chunk_free (size_t)
+obstack_chunk_free (void *)
 {
   /* Do nothing. For our purposes there should be very little
      de-allocation. */
@@ -217,14 +217,13 @@  __vtv_malloc_init (void)
 #endif
     VTV_error ();
 
-  obstack_chunk_size (&vtv_obstack) = VTV_PAGE_SIZE;
-  obstack_alignment_mask (&vtv_obstack) = sizeof (long) - 1;
   /* We guarantee that the obstack alloc failed handler will never be
      called because in case the allocation of the chunk fails, it will
      never return */
   obstack_alloc_failed_handler = NULL;
 
-  obstack_init (&vtv_obstack);
+  obstack_specify_allocation (&vtv_obstack, VTV_PAGE_SIZE, sizeof (long),
+			      obstack_chunk_alloc, obstack_chunk_free);
   malloc_initialized = 1;
 }