unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#15094: Fix for posix_memalign on Cygwin
@ 2013-08-14 16:22 Ken Brown
  2013-08-14 19:11 ` Ken Brown
  0 siblings, 1 reply; 9+ messages in thread
From: Ken Brown @ 2013-08-14 16:22 UTC (permalink / raw)
  To: 15094

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

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

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

=== 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;


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-08-15 16:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-14 16:22 bug#15094: Fix for posix_memalign on Cygwin Ken Brown
2013-08-14 19:11 ` Ken Brown
2013-08-14 19:29   ` Eli Zaretskii
2013-08-14 19:52     ` Ken Brown
2013-08-15  2:46       ` Eli Zaretskii
2013-08-15 11:51         ` Ken Brown
2013-08-15 13:00           ` Ken Brown
2013-08-15 16:15             ` Ken Brown
2013-08-15 16:39               ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).