This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: A patch for malloc typo


On Tue, Sep 19, 2000 at 11:52:33AM -0700, H . J . Lu wrote:
> The order of parameters passed to mEMALIGn in memalign_hook_ini is
> wrong. Here is a patch.
> 

This patch should have no impact on generated binaries. It just makes
the code less confusing.

H.J.
---
2000-09-19  H.J. Lu  <hjl@gnu.org>

	* malloc/malloc.h (__memalign_hook): Fix the parameter order.
	* malloc/malloc.c (__memalign_hook): Likewise.
	(memalign_hook_ini): Likewise.

Index: malloc/malloc.c
===================================================================
RCS file: /work/cvs/gnu/glibc/malloc/malloc.c,v
retrieving revision 1.1.1.9
diff -u -p -r1.1.1.9 malloc.c
--- malloc/malloc.c	2000/08/31 16:48:37	1.1.1.9
+++ malloc/malloc.c	2000/09/19 19:05:49
@@ -1772,15 +1772,15 @@ realloc_hook_ini(ptr, sz, caller)
 
 static Void_t*
 #if __STD_C
-memalign_hook_ini(size_t sz, size_t alignment, const __malloc_ptr_t caller)
+memalign_hook_ini(size_t alignment, size_t sz, const __malloc_ptr_t caller)
 #else
-memalign_hook_ini(sz, alignment, caller)
-     size_t sz; size_t alignment; const __malloc_ptr_t caller;
+memalign_hook_ini(alignment, sz, caller)
+     size_t alignment; size_t sz; const __malloc_ptr_t caller;
 #endif
 {
   __memalign_hook = NULL;
   ptmalloc_init();
-  return mEMALIGn(sz, alignment);
+  return mEMALIGn(alignment, sz);
 }
 
 void weak_variable (*__malloc_initialize_hook) __MALLOC_P ((void)) = NULL;
@@ -1792,7 +1792,7 @@ __malloc_ptr_t weak_variable (*__realloc
  __MALLOC_P ((__malloc_ptr_t __ptr, size_t __size, const __malloc_ptr_t))
      = realloc_hook_ini;
 __malloc_ptr_t weak_variable (*__memalign_hook)
- __MALLOC_P ((size_t __size, size_t __alignment, const __malloc_ptr_t))
+ __MALLOC_P ((size_t __alignment, size_t __size, const __malloc_ptr_t))
      = memalign_hook_ini;
 void weak_variable (*__after_morecore_hook) __MALLOC_P ((void)) = NULL;
 
Index: malloc/malloc.h
===================================================================
RCS file: /work/cvs/gnu/glibc/malloc/malloc.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 malloc.h
--- malloc/malloc.h	2000/05/21 21:11:15	1.1.1.1
+++ malloc/malloc.h	2000/09/19 19:03:41
@@ -225,8 +225,8 @@ extern __malloc_ptr_t (*__malloc_hook) _
 extern __malloc_ptr_t (*__realloc_hook) __MALLOC_PMT ((__malloc_ptr_t __ptr,
 						     size_t __size,
 						     __const __malloc_ptr_t));
-extern __malloc_ptr_t (*__memalign_hook) __MALLOC_PMT ((size_t __size,
-						      size_t __alignment,
+extern __malloc_ptr_t (*__memalign_hook) __MALLOC_PMT ((size_t __alignment,
+						      size_t __size,
 						      __const __malloc_ptr_t));
 extern void (*__after_morecore_hook) __MALLOC_PMT ((void));
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]