]> granicus.if.org Git - graphviz/commitdiff
- add configure check for sys/mman.h
authorellson <devnull@localhost>
Mon, 19 Jun 2006 13:14:36 +0000 (13:14 +0000)
committerellson <devnull@localhost>
Mon, 19 Jun 2006 13:14:36 +0000 (13:14 +0000)
- defined(HAVE_SYS_MMAN_H)  use: mmap, munmap
- else use: malloc, read, free

configure.ac
lib/common/psgen.c
plugin/core/gvloadimage_core.c

index d69a6b8fe4b266855737e408cc60f1f24d7d2591..75c615c5a1a601bd24a346a15ec84cdc97eee705 100644 (file)
@@ -242,8 +242,9 @@ dnl Checks for header files
 # AC_HAVE_HEADERS(string.h)
 AC_CHECK_HEADERS(stdarg.h stddef.h stddef.h stdlib.h stdint.h malloc.h \
        search.h getopt.h pthread.h values.h float.h limits.h termios.h \
-       errno.h time.h sys/time.h sys/times.h sys/types.h unistd.h fenv.h \
-       sys/select.h fpu_control.h sys/fpu.h strings.h sys/socket.h sys/stat.h)
+       errno.h time.h unistd.h fenv.h strings.h \
+       sys/time.h sys/times.h sys/types.h sys/select.h fpu_control.h \
+       sys/fpu.h strings.h sys/socket.h sys/stat.h sys/mman.h)
 AC_HEADER_TIME
 AC_HEADER_DIRENT
 AC_HEADER_STDBOOL
index ab203a667b4930e90f694e67c0be75cf3f585ddf..e827118bf34eef75bf8c1ed1b88dd2e61bc1ade7 100644 (file)
@@ -23,7 +23,9 @@
 
 #include "render.h"
 #include "agxbuf.h"
+#if HAVE_SYS_MMAN_H
 #include <sys/mman.h>
+#endif
 #include <sys/types.h>
 #include <sys/stat.h>
 
@@ -518,7 +520,11 @@ static void ps_freeimage_gd (usershape_t *us)
 
 static void ps_freeimage_ps (usershape_t *us)
 {
+#if HAVE_SYS_MMAN_H
     munmap(us->data, us->datasize);
+#else
+    free(us->data);
+#endif
 }
 
 /* ps_usershape:
@@ -598,7 +604,12 @@ static void ps_usershape(usershape_t *us, boxf b, point *A, int n, bool filled)
            case FT_EPS:
                 fstat(fd, &statbuf);
                 us->datasize = statbuf.st_size;
+#if HAVE_SYS_MMAN_H
                 us->data = mmap(0, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0);
+#else
+               us->data = malloc(statbuf.st_size);
+               read(fd, us->data, statbuf.st_size);
+#endif
                 us->datafree = ps_freeimage_ps;
                 us->must_inline = true;
                break;
index c31150a502ec876d89f5c222546c33240ed28966..5ac8e8eeb0f05e73a79c07bd51ed0c6db9c27dfd 100644 (file)
@@ -19,7 +19,9 @@
 #endif
 
 #include <stdlib.h>
+#if HAVE_SYS_MMAN_H
 #include <sys/mman.h>
+#endif
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
@@ -58,7 +60,11 @@ static void core_loadimage_svg(GVJ_t * job, usershape_t *us, boxf b, bool filled
 
 static void ps_freeimage(usershape_t *us)
 {
+#if HAVE_SYS_MMAN_H
     munmap(us->data, us->datasize);
+#else
+    free(us->data);
+#endif
 }
 
 /* usershape described by a postscript function */
@@ -114,7 +120,12 @@ static void core_loadimage_ps(GVJ_t * job, usershape_t *us, boxf b, bool filled)
             case FT_EPS:
                fstat(fd, &statbuf);
                us->datasize = statbuf.st_size;
+#if HAVE_SYS_MMAN_H
                us->data = mmap(0, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0);
+#else
+               us->data = malloc(statbuf.st_size);
+               read(fd, us->data, statbuf.st_size);
+#endif
                us->must_inline = true;
                 break;
             default: