diff options
author | Choe Hwanjin <choe.hwanjin@gmail.com> | 2008-02-24 10:43:55 +0900 |
---|---|---|
committer | Choe Hwanjin <choe.hwanjin@gmail.com> | 2008-02-24 10:43:55 +0900 |
commit | 6eaad37ac121619b1a91a6dd5596ce01abe9efe2 (patch) | |
tree | e0594d6b3c4f4c62e9429faffac8317d73f4cd3d /hangul | |
parent | 5b2528e7cb4c56951520d8d0d10b2e205b23cb22 (diff) | |
download | libhangul-6eaad37ac121619b1a91a6dd5596ce01abe9efe2.tar.gz |
mmap system call이 없는 시스템을 위한 코드 추가
git-svn-id: http://kldp.net/svn/hangul/libhangul/trunk@162 8f00fcd2-89fc-0310-932e-b01be5b65e01
Diffstat (limited to 'hangul')
-rw-r--r-- | hangul/hanja.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/hangul/hanja.c b/hangul/hanja.c index ef07db5..ec17c55 100644 --- a/hangul/hanja.c +++ b/hangul/hanja.c @@ -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) { |