mmap system call이 없는 시스템을 위한 코드 추가
authorChoe Hwanjin <choe.hwanjin@gmail.com>
Sun, 24 Feb 2008 01:43:55 +0000 (10:43 +0900)
committerChoe Hwanjin <choe.hwanjin@gmail.com>
Sun, 24 Feb 2008 01:43:55 +0000 (10:43 +0900)
git-svn-id: http://kldp.net/svn/hangul/libhangul/trunk@162 8f00fcd2-89fc-0310-932e-b01be5b65e01

hangul/hanja.c

index ef07db5..ec17c55 100644 (file)
@@ -24,7 +24,9 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
+#ifdef HAVE_MMAP
 #include <sys/mman.h>
+#endif
 
 #include <limits.h>
 #include <stdio.h>
@@ -270,6 +272,28 @@ static inline char* utf8_prev(const char *str, const char *p)
     return (char*)p;
 }
 
+#ifndef HAVE_MMAP
+
+#define PROT_READ 0
+#define MAP_SHARED 0
+static void*
+mmap(void *start, size_t length, int prot, int flags, int fd, size_t offset)
+{
+    start = malloc(length);
+    if (start != NULL) {
+       read(fd, start, length);
+    }
+    return start;
+}
+
+static int
+munmap(void *start, size_t length)
+{
+    free(start);
+}
+
+#endif
+
 static PtrVector*
 ptr_vector_new(size_t initial_size)
 {