Print this page
5051 import mdocml-1.12.3
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Approved by: TBD
*** 1,6 ****
! /* $Id: preconv.c,v 1.5 2011/07/24 18:15:14 kristaps Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
--- 1,6 ----
! /* $Id: preconv.c,v 1.6 2013/06/02 03:52:21 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
*** 30,46 ****
#include <string.h>
#include <unistd.h>
/*
* The read_whole_file() and resize_buf() functions are copied from
! * read.c, including all dependency code (MAP_FILE, etc.).
*/
- #ifndef MAP_FILE
- #define MAP_FILE 0
- #endif
-
enum enc {
ENC_UTF_8, /* UTF-8 */
ENC_US_ASCII, /* US-ASCII */
ENC_LATIN_1, /* Latin-1 */
ENC__MAX
--- 30,42 ----
#include <string.h>
#include <unistd.h>
/*
* The read_whole_file() and resize_buf() functions are copied from
! * read.c, including all dependency code.
*/
enum enc {
ENC_UTF_8, /* UTF-8 */
ENC_US_ASCII, /* US-ASCII */
ENC_LATIN_1, /* Latin-1 */
ENC__MAX
*** 269,280 ****
}
if (S_ISREG(st.st_mode)) {
*with_mmap = 1;
fb->sz = (size_t)st.st_size;
! fb->buf = mmap(NULL, fb->sz, PROT_READ,
! MAP_FILE|MAP_SHARED, fd, 0);
if (fb->buf != MAP_FAILED)
return(1);
}
#endif
--- 265,275 ----
}
if (S_ISREG(st.st_mode)) {
*with_mmap = 1;
fb->sz = (size_t)st.st_size;
! fb->buf = mmap(NULL, fb->sz, PROT_READ, MAP_SHARED, fd, 0);
if (fb->buf != MAP_FAILED)
return(1);
}
#endif