Subject: bug#9119: closed (Re: bug#9119: [PATCH] modernize function definitions in gmalloc.c)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 22 Apr 2012 19:29:03 +0000

Your bug report

#9119: [PATCH] modernize function definitions in gmalloc.c

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
9119: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9119
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#9119: [PATCH] modernize function definitions in gmalloc.c
From: Paul Eggert <[email-masked]>
To: Ken Brown <[email-masked]>
Cc: [email-masked], Eli Zaretskii <[email-masked]>, [email-masked], [email-masked], [email-masked]
Date: Sun, 22 Apr 2012 12:27:56 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

On 04/14/2012 04:15 AM, Ken Brown wrote:
> So I don't know if that patch should just be applied now
> or if Paul plans to do more cleanup.

I just now applied a slightly-updated version of the last
patch that I suggested in this thread, into the trunk as
bzr 107999, and I'm marking this as done.  The code is
still pretty crufty and I'm sure it still has bugs on some
platforms but someone who regularly debugs on those
platforms would need to look at it.

Subject: [PATCH] modernize function definitions in gmalloc.c
From: Daniel Colascione <[email-masked]>
To: [email-masked]
Date: Mon, 18 Jul 2011 16:46:36 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

The warnings were annoying me.

=== modified file 'src/ChangeLog'
--- src/ChangeLog	2011-07-18 20:32:34 +0000
+++ src/ChangeLog	2011-07-18 23:38:06 +0000
@@ -1,5 +1,7 @@
 2011-07-18  Daniel Colascione  <[email-masked]>

+	* gmalloc.c: modernize function definitions throughout.

 2011-07-18  Paul Eggert  <[email-masked]>

=== modified file 'src/gmalloc.c'
--- src/gmalloc.c	2011-05-28 22:39:39 +0000
+++ src/gmalloc.c	2011-07-18 23:38:06 +0000
@@ -485,8 +485,7 @@
 /* Aligned allocation.  */
 static __ptr_t align PP ((__malloc_size_t));
 static __ptr_t
-align (size)
-     __malloc_size_t size;
+align (__malloc_size_t size)
 {
   __ptr_t result;
   unsigned long int adj;
@@ -520,9 +519,8 @@
    If we cannot get space at END, fail and return 0.  */
 static __ptr_t get_contiguous_space PP ((__malloc_ptrdiff_t, __ptr_t));
 static __ptr_t
-get_contiguous_space (size, position)
-     __malloc_ptrdiff_t size;
-     __ptr_t position;
+get_contiguous_space (__malloc_ptrdiff_t size,
+                      __ptr_t position)
 {
   __ptr_t before;
   __ptr_t after;
@@ -578,21 +576,21 @@
 int _malloc_thread_enabled_p;

 static void
-malloc_atfork_handler_prepare ()
+malloc_atfork_handler_prepare (void)
 {
   LOCK ();
   LOCK_ALIGNED_BLOCKS ();
 }

 static void
-malloc_atfork_handler_parent ()
+malloc_atfork_handler_parent (void)
 {
   UNLOCK_ALIGNED_BLOCKS ();
   UNLOCK ();
 }

 static void
-malloc_atfork_handler_child ()
+malloc_atfork_handler_child (void)
 {
   UNLOCK_ALIGNED_BLOCKS ();
   UNLOCK ();
@@ -600,7 +598,7 @@

 /* Set up mutexes and make malloc etc. thread-safe.  */
 void
-malloc_enable_thread ()
+malloc_enable_thread (void)
 {
   if (_malloc_thread_enabled_p)
     return;
@@ -619,7 +617,7 @@
 #endif

 static void
-malloc_initialize_1 ()
+malloc_initialize_1 (void)
 {
 #ifdef GC_MCHECK
   mcheck (NULL);
@@ -650,7 +648,7 @@
    main will call malloc which calls this function.  That is before any
threads
    or signal handlers has been set up, so we don't need thread
protection.  */
 int
-__malloc_initialize ()
+__malloc_initialize (void)
 {
   if (__malloc_initialized)
     return 0;
@@ -666,8 +664,7 @@
    growing the heap info table as necessary. */
 static __ptr_t morecore_nolock PP ((__malloc_size_t));
 static __ptr_t
-morecore_nolock (size)
-     __malloc_size_t size;
+morecore_nolock (__malloc_size_t size)
 {
   __ptr_t result;
   malloc_info *newinfo, *oldinfo;
@@ -780,8 +777,7 @@

 /* Allocate memory from the heap.  */
 __ptr_t
-_malloc_internal_nolock (size)
-     __malloc_size_t size;
+_malloc_internal_nolock (__malloc_size_t size)
 {
   __ptr_t result;
   __malloc_size_t block, blocks, lastblocks, start;
@@ -980,8 +976,7 @@
 }

 __ptr_t
-_malloc_internal (size)
-     __malloc_size_t size;
+_malloc_internal (__malloc_size_t size)
 {
   __ptr_t result;

@@ -993,8 +988,7 @@
 }

 __ptr_t
-malloc (size)
-     __malloc_size_t size;
+malloc (__malloc_size_t size)
 {
   __ptr_t (*hook) (__malloc_size_t);

@@ -1019,23 +1013,19 @@
    and _realloc.  Make them use the GNU functions.  */

 __ptr_t
-_malloc (size)
-     __malloc_size_t size;
+_malloc (__malloc_size_t size)
 {
   return malloc (size);
 }

 void
-_free (ptr)
-     __ptr_t ptr;
+_free (__ptr_t ptr)
 {
   free (ptr);
 }

 __ptr_t
-_realloc (ptr, size)
-     __ptr_t ptr;
-     __malloc_size_t size;
+_realloc (__ptr_t ptr, __malloc_size_t size)
 {
   return realloc (ptr, size);
 }
@@ -1341,8 +1331,7 @@
 /* Return memory to the heap.
    Like `free' but don't call a __free_hook if there is one.  */
 void
-_free_internal (ptr)
-     __ptr_t ptr;
+_free_internal (__ptr_t ptr)
 {
   LOCK ();
   _free_internal_nolock (ptr);
@@ -1352,8 +1341,7 @@
 /* Return memory to the heap.  */

 void
-free (ptr)
-     __ptr_t ptr;
+free (__ptr_t ptr)
 {
   void (*hook) (__ptr_t) = __free_hook;

@@ -1368,8 +1356,7 @@
 weak_alias (free, cfree)
 #else
 void
-cfree (ptr)
-     __ptr_t ptr;
+cfree (__ptr_t ptr)
 {
   free (ptr);
 }
@@ -1417,10 +1404,9 @@
 /* Like bcopy except never gets confused by overlap.  */

 void
-__malloc_safe_bcopy (afrom, ato, size)
-     __ptr_t afrom;
-     __ptr_t ato;
-     __malloc_size_t size;
+__malloc_safe_bcopy (__ptr_t afrom,
+                     __ptr_t ato,
+                     __malloc_size_t size)
 {
   char *from = afrom, *to = ato;

@@ -1493,9 +1479,7 @@
    new region.  This module has incestuous knowledge of the
    internals of both free and malloc. */
 __ptr_t
-_realloc_internal_nolock (ptr, size)
-     __ptr_t ptr;
-     __malloc_size_t size;
+_realloc_internal_nolock (__ptr_t ptr, __malloc_size_t size)
 {
   __ptr_t result;
   int type;
@@ -1611,9 +1595,8 @@
 }

 __ptr_t
-_realloc_internal (ptr, size)
-     __ptr_t ptr;
-     __malloc_size_t size;
+_realloc_internal (__ptr_t ptr,
+                   __malloc_size_t size)
 {
   __ptr_t result;

@@ -1625,9 +1608,8 @@
 }

 __ptr_t
-realloc (ptr, size)
-     __ptr_t ptr;
-     __malloc_size_t size;
+realloc (__ptr_t ptr,
+         __malloc_size_t size)
 {
   __ptr_t (*hook) (__ptr_t, __malloc_size_t);

@@ -1665,9 +1647,8 @@
 /* Allocate an array of NMEMB elements each SIZE bytes long.
    The entire array is initialized to zeros.  */
 __ptr_t
-calloc (nmemb, size)
-     register __malloc_size_t nmemb;
-     register __malloc_size_t size;
+calloc (register __malloc_size_t nmemb,
+        register __malloc_size_t size)
 {
   register __ptr_t result = malloc (nmemb * size);

@@ -1719,8 +1700,7 @@
    and return the start of data space, or NULL on errors.
    If INCREMENT is negative, shrink data space.  */
 __ptr_t
-__default_morecore (increment)
-     __malloc_ptrdiff_t increment;
+__default_morecore (__malloc_ptrdiff_t increment)
 {
   __ptr_t result;
 #if defined(CYGWIN)
@@ -1760,9 +1740,8 @@
 				__malloc_size_t __alignment));

 __ptr_t
-memalign (alignment, size)
-     __malloc_size_t alignment;
-     __malloc_size_t size;
+memalign (__malloc_size_t alignment,
+          __malloc_size_t size)
 {
   __ptr_t result;
   unsigned long int adj, lastadj;
@@ -1843,10 +1822,9 @@
 #endif

 int
-posix_memalign (memptr, alignment, size)
-     __ptr_t *memptr;
-     __malloc_size_t alignment;
-     __malloc_size_t size;
+posix_memalign (__ptr_t *memptr,
+                __malloc_size_t alignment,
+                __malloc_size_t size)
 {
   __ptr_t mem;

@@ -1917,8 +1895,7 @@
 static __malloc_size_t pagesize;

 __ptr_t
-valloc (size)
-     __malloc_size_t size;
+valloc (__malloc_size_t size)
 {
   if (pagesize == 0)
     pagesize = __getpagesize ();
@@ -2001,8 +1978,7 @@

 static enum mcheck_status checkhdr (const struct hdr *);
 static enum mcheck_status
-checkhdr (hdr)
-     const struct hdr *hdr;
+checkhdr (const struct hdr *hdr)
 {
   enum mcheck_status status;
   switch (hdr->magic)
@@ -2025,10 +2001,8 @@
   return status;
 }

-static void freehook (__ptr_t);
 static void
-freehook (ptr)
-     __ptr_t ptr;
+freehook (__ptr_t ptr)
 {
   struct hdr *hdr;

@@ -2047,10 +2021,8 @@
   __free_hook = freehook;
 }

-static __ptr_t mallochook (__malloc_size_t);
 static __ptr_t
-mallochook (size)
-     __malloc_size_t size;
+mallochook (__malloc_size_t size)
 {
   struct hdr *hdr;

@@ -2067,11 +2039,9 @@
   return (__ptr_t) (hdr + 1);
 }

-static __ptr_t reallochook (__ptr_t, __malloc_size_t);
 static __ptr_t
-reallochook (ptr, size)
-     __ptr_t ptr;
-     __malloc_size_t size;
+reallochook (__ptr_t ptr,
+             __malloc_size_t size)
 {
   struct hdr *hdr = NULL;
   __malloc_size_t osize = 0;
@@ -2105,8 +2075,7 @@
 }

 static void
-mabort (status)
-     enum mcheck_status status;
+mabort (enum mcheck_status status)
 {
   const char *msg;
   switch (status)
@@ -2139,8 +2108,7 @@
 static int mcheck_used = 0;

 int
-mcheck (func)
-     void (*func) (enum mcheck_status);
+mcheck (void (*func) (enum mcheck_status))
 {
   abortfunc = (func != NULL) ? func : &mabort;