Subject: bug#15094: closed (Re: bug#15094: Fix for posix_memalign on Cygwin)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 14 Aug 2013 19:12:02 +0000

Your bug report

#15094: Fix for posix_memalign on Cygwin

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].

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

Subject: Re: bug#15094: Fix for posix_memalign on Cygwin
From: Ken Brown <[email-masked]>
To: [email-masked]
Date: Wed, 14 Aug 2013 15:11:09 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

On 8/14/2013 12:22 PM, Ken Brown wrote:
> Cygwin allows applications to supply their own malloc but not, until
> today, their own posix_memalign.  This has caused problems with the GTK
> build of Emacs on Cygwin.  The problem became worse with the latest Glib
> update.  Anyone who wants the gory details can find them starting here:
>
>    http://cygwin.com/ml/cygwin-xfree/2013-08/msg00018.html
>
> Cygwin was just patched today to allow applications to supply their own
> posix_memalign (but not their own memalign), which solves the Glib
> problem.  But posix_memalign in gmalloc.c calls memalign, so I need to
> make sure that it calls Emacs's memalign.  The attached patch does this.
>   Is this a reasonable way to handle the problem?  (I plan to also add
> an explanatory comment.)

I made this more complicated than necessary.  I've installed a simpler 
version as bzr revision 113880, and I'm closing the bug.

Ken

Subject: Fix for posix_memalign on Cygwin
From: Ken Brown <[email-masked]>
To: emacs-bug <[email-masked]>
Date: Wed, 14 Aug 2013 12:22:18 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Cygwin allows applications to supply their own malloc but not, until 
today, their own posix_memalign.  This has caused problems with the GTK 
build of Emacs on Cygwin.  The problem became worse with the latest Glib 
update.  Anyone who wants the gory details can find them starting here:

   http://cygwin.com/ml/cygwin-xfree/2013-08/msg00018.html

Cygwin was just patched today to allow applications to supply their own 
posix_memalign (but not their own memalign), which solves the Glib 
problem.  But posix_memalign in gmalloc.c calls memalign, so I need to 
make sure that it calls Emacs's memalign.  The attached patch does this. 
  Is this a reasonable way to handle the problem?  (I plan to also add 
an explanatory comment.)

Thanks.

Ken
=== modified file 'src/gmalloc.c'
--- src/gmalloc.c	2013-01-02 16:13:04 +0000
+++ src/gmalloc.c	2013-08-14 16:01:02 +0000
@@ -1558,8 +1558,14 @@
 
 void *(*__memalign_hook) (size_t size, size_t alignment);
 
+#ifdef CYGWIN
+#define memalign memalign1
+void *
+memalign1 (size_t alignment, size_t size)
+#else
 void *
 memalign (size_t alignment, size_t size)
+#endif
 {
   void *result;
   size_t adj, lastadj;