From c486ea9c3582710474c1085c21c1dc5e2700adc3 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 12 Aug 2009 19:36:29 -0400 Subject: [PATCH] =?utf8?q?Bug=20591511=20=E2=80=93=20hb-blob.c=20does=20no?= =?utf8?q?t=20compile=20using=20mingw=20on=20windows?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Only call mprotect() when available. For optimal performance, a win32 way to make memory writeable needs to be added. --- src/hb-blob.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/hb-blob.c b/src/hb-blob.c index 6939049..178bc8e 100644 --- a/src/hb-blob.c +++ b/src/hb-blob.c @@ -28,8 +28,12 @@ #include "hb-blob.h" +#ifdef HAVE_MPROTECT +#ifdef HAVE_UNISTD_H #include +#endif /* HAVE_UNISTD_H */ #include +#endif /* HAVE_MPROTECT */ struct _hb_blob_t { hb_reference_count_t ref_count; @@ -240,6 +244,7 @@ hb_blob_try_writeable_inplace (hb_blob_t *blob) hb_mutex_lock (blob->lock); +#ifdef HAVE_MPROTECT if (blob->mode == HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITEABLE) { unsigned int pagesize, mask, length; const char *addr; @@ -281,6 +286,9 @@ hb_blob_try_writeable_inplace (hb_blob_t *blob) addr, addr+length, length); #endif } +#else /* !HAVE_MPROTECT */ +#warning "No way to make readonly memory writeable. This is suboptimal." +#endif done: mode = blob->mode; -- 2.7.4