all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ken Brown <kbrown@cornell.edu>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: Daniel Colascione <dancol@dancol.org>, emacs-devel@gnu.org
Subject: Re: [PATCH 1/4] Compilation cleanups
Date: Sat, 31 Dec 2011 09:50:43 -0500	[thread overview]
Message-ID: <4EFF2143.6010804@cornell.edu> (raw)
In-Reply-To: <4EFCA94B.9020502@cs.ucla.edu>

[-- Attachment #1: Type: text/plain, Size: 1053 bytes --]



On 12/29/2011 12:54 PM, Paul Eggert wrote:
> On 12/29/11 06:03, Daniel Colascione wrote:
>
>> --- a/lib-src/update-game-score.c
>> +++ b/lib-src/update-game-score.c
>> @@ -48,8 +48,10 @@ along with GNU Emacs.  If not, see<http://www.gnu.org/licenses/>.  */
>>   #include<sys/stat.h>
>>
>>   /* Needed for SunOS4, for instance.  */
>> +#if !defined(CYGWIN)
>>   extern char *optarg;
>>   extern int optind, opterr;
>> +#endif // !defined(CYGWIN)
>
> I suggest replacing those lines with "#include<getopt.h>" instead;
> that's what the other .c files do, and it's cleaner.
>
>
>> --- a/src/gmalloc.c
>> +++ b/src/gmalloc.c
> ...
>> -  if (ptr<  _heapbase)
>> +  if ((char*)ptr<  (char*)_heapbase)
>
> No need to cast _heapbase as it's already a char *.
> And please put a space after the ')', e.g.,
> "(char*) ptr<  _heapbase", as that's the usual
> Emacs style.

And as long as we're cleaning up, why don't we get rid of all those 
warnings about old-style function definitions in gmalloc.c.  A revision 
of Daniel's patch that does this is attached.


[-- Attachment #2: cleanup.patch --]
[-- Type: text/plain, Size: 7921 bytes --]

=== modified file 'lib-src/update-game-score.c'
--- lib-src/update-game-score.c	2011-11-17 09:09:20 +0000
+++ lib-src/update-game-score.c	2011-12-31 14:09:29 +0000
@@ -46,10 +46,7 @@
 #include <fcntl.h>
 #endif
 #include <sys/stat.h>
-
-/* Needed for SunOS4, for instance.  */
-extern char *optarg;
-extern int optind, opterr;
+#include <getopt.h>
 
 static int usage (int err) NO_RETURN;
 

=== modified file 'src/gmalloc.c'
--- src/gmalloc.c	2011-09-09 01:06:52 +0000
+++ src/gmalloc.c	2011-12-31 14:36:48 +0000
@@ -455,8 +455,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;
@@ -490,9 +489,7 @@
    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;
@@ -548,21 +545,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 ();
@@ -570,7 +567,7 @@
 
 /* Set up mutexes and make malloc etc. thread-safe.  */
 void
-malloc_enable_thread ()
+malloc_enable_thread (void)
 {
   if (_malloc_thread_enabled_p)
     return;
@@ -589,7 +586,7 @@
 #endif
 
 static void
-malloc_initialize_1 ()
+malloc_initialize_1 (void)
 {
 #ifdef GC_MCHECK
   mcheck (NULL);
@@ -630,7 +627,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;
@@ -646,8 +643,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;
@@ -760,8 +756,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;
@@ -960,8 +955,7 @@
 }
 
 __ptr_t
-_malloc_internal (size)
-     __malloc_size_t size;
+_malloc_internal (__malloc_size_t size)
 {
   __ptr_t result;
 
@@ -973,8 +967,7 @@
 }
 
 __ptr_t
-malloc (size)
-     __malloc_size_t size;
+malloc (__malloc_size_t size)
 {
   __ptr_t (*hook) (__malloc_size_t);
 
@@ -999,23 +992,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);
 }
@@ -1058,8 +1047,7 @@
 /* Return memory to the heap.
    Like `_free_internal' but don't lock mutex.  */
 void
-_free_internal_nolock (ptr)
-     __ptr_t ptr;
+_free_internal_nolock (__ptr_t ptr)
 {
   int type;
   __malloc_size_t block, blocks;
@@ -1076,7 +1064,7 @@
     return;
 
 #ifdef CYGWIN
-  if (ptr < _heapbase)
+  if ((char*) ptr < _heapbase)
     /* We're being asked to free something in the static heap. */
     return;
 #endif
@@ -1313,8 +1301,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);
@@ -1324,8 +1311,7 @@
 /* Return memory to the heap.  */
 
 void
-free (ptr)
-     __ptr_t ptr;
+free (__ptr_t ptr)
 {
   void (*hook) (__ptr_t) = __free_hook;
 
@@ -1340,8 +1326,7 @@
 weak_alias (free, cfree)
 #else
 void
-cfree (ptr)
-     __ptr_t ptr;
+cfree (__ptr_t ptr)
 {
   free (ptr);
 }
@@ -1381,9 +1366,7 @@
    data.  */
 #ifdef CYGWIN
 __ptr_t
-special_realloc (ptr, size)
-     __ptr_t ptr;
-     __malloc_size_t size;
+special_realloc (__ptr_t ptr, __malloc_size_t size)
 {
   __ptr_t result;
   int type;
@@ -1411,9 +1394,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;
@@ -1428,7 +1409,7 @@
     return _malloc_internal_nolock (size);
 
 #ifdef CYGWIN
-  if (ptr < _heapbase)
+  if ((char*) ptr < _heapbase)
     /* ptr points into the static heap */
     return special_realloc (ptr, size);
 #endif
@@ -1535,9 +1516,7 @@
 }
 
 __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;
 
@@ -1549,9 +1528,7 @@
 }
 
 __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);
 
@@ -1589,9 +1566,7 @@
 /* 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);
 
@@ -1643,8 +1618,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)
@@ -1684,9 +1658,7 @@
 				__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;
@@ -1767,10 +1739,8 @@
 #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;
 
@@ -1841,8 +1811,7 @@
 static __malloc_size_t pagesize;
 
 __ptr_t
-valloc (size)
-     __malloc_size_t size;
+valloc (__malloc_size_t size)
 {
   if (pagesize == 0)
     pagesize = __getpagesize ();
@@ -1935,8 +1904,7 @@
 
 static void freehook (__ptr_t);
 static void
-freehook (ptr)
-     __ptr_t ptr;
+freehook (__ptr_t ptr)
 {
   struct hdr *hdr;
 
@@ -1957,8 +1925,7 @@
 
 static __ptr_t mallochook (__malloc_size_t);
 static __ptr_t
-mallochook (size)
-     __malloc_size_t size;
+mallochook (__malloc_size_t size)
 {
   struct hdr *hdr;
 
@@ -1977,9 +1944,7 @@
 
 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;

=== modified file 'src/unexcw.c'
--- src/unexcw.c	2011-08-16 13:27:12 +0000
+++ src/unexcw.c	2011-12-31 13:52:57 +0000
@@ -31,6 +31,8 @@
 
 #define DOTEXE ".exe"
 
+extern void report_sheap_usage (int);
+
 extern int bss_sbrk_did_unexec;
 
 extern int __malloc_initialized;


  reply	other threads:[~2011-12-31 14:50 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-29 14:03 [PATCH 0/4] Support Win32 GUI in Cygwin Emacs Daniel Colascione
2011-12-29 14:03 ` [PATCH 3/4] Implement cygw32 Daniel Colascione
2011-12-29 17:29   ` Eli Zaretskii
2011-12-29 17:53     ` Daniel Colascione
2011-12-29 18:17       ` Eli Zaretskii
2011-12-29 21:50         ` Daniel Colascione
2011-12-30  0:56           ` Jason Rumney
2011-12-30  9:23           ` Eli Zaretskii
2011-12-30  9:36             ` Daniel Colascione
2011-12-30 11:16               ` Eli Zaretskii
2011-12-30  9:49   ` Andreas Schwab
2011-12-29 14:03 ` [PATCH 1/4] Compilation cleanups Daniel Colascione
2011-12-29 17:54   ` Paul Eggert
2011-12-31 14:50     ` Ken Brown [this message]
2011-12-31 20:29       ` Paul Eggert
2011-12-29 14:03 ` [PATCH 4/4] Fix emacsclient to work with cygw32 Daniel Colascione
2011-12-29 16:28   ` Juanma Barranquero
2011-12-29 16:36     ` Daniel Colascione
2011-12-29 16:43       ` Juanma Barranquero
2011-12-29 16:47         ` Daniel Colascione
2011-12-29 16:49           ` Juanma Barranquero
2011-12-29 17:39   ` Eli Zaretskii
2011-12-29 17:56     ` Daniel Colascione
2011-12-29 18:18       ` Eli Zaretskii
2011-12-29 18:53         ` Juanma Barranquero
2011-12-29 14:03 ` [PATCH 2/4] Refactor window-system configuration Daniel Colascione
2011-12-29 22:21   ` Dan Nicolaescu
2011-12-29 22:29     ` Daniel Colascione
2011-12-29 22:43       ` Dan Nicolaescu
2011-12-29 22:48         ` Daniel Colascione
2011-12-29 23:05           ` Dan Nicolaescu
2011-12-29 23:08             ` Daniel Colascione
2011-12-30  8:54             ` Eli Zaretskii
2011-12-30  9:07               ` Daniel Colascione
2011-12-30  9:44                 ` Eli Zaretskii
2011-12-30  0:53       ` Stefan Monnier
2011-12-30  8:21       ` Eli Zaretskii
2011-12-30  8:26         ` Daniel Colascione
2011-12-30  9:38           ` Eli Zaretskii
2011-12-30  9:45             ` Daniel Colascione
2011-12-30 11:15             ` Stefan Monnier
2011-12-30  8:19     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EFF2143.6010804@cornell.edu \
    --to=kbrown@cornell.edu \
    --cc=dancol@dancol.org \
    --cc=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.