From f23385c3cbc7638d83faf1a3f7d33fe387e9b005 Mon Sep 17 00:00:00 2001 From: Adam Heath Date: Mon, 23 Apr 2001 00:03:06 +0000 Subject: [PATCH] s/PARSE_MMAP/HAVE_MMAP/, so that we now use mmap to read status and available(and like files). --- ChangeLog | 5 +++++ lib/parse.c | 11 ++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2a3a1c0f..8ce924f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Apr 22 19:02:12 CDT 2001 Adam Heath + + * lib/parse.c: s/PARSE_MMAP/HAVE_MMAP/, so that we now use mmap + to read status and available(and like files). + Sun Apr 22 18:32:02 CDT 2001 Adam Heath * lib/parse.c: Fix another segfault when parsing single-paragraph diff --git a/lib/parse.c b/lib/parse.c index 646794dc..15525523 100644 --- a/lib/parse.c +++ b/lib/parse.c @@ -29,15 +29,16 @@ #include #include #include -#ifdef PARSE_MMAP -#include -#endif #include #include #include #include "parsedump.h" +#ifdef HAVE_MMAP +#include +#endif + const struct fieldinfo fieldinfos[]= { /* NB: capitalisation of these strings is important. */ { "Package", f_name, w_name }, @@ -108,7 +109,7 @@ int parsedb(const char *filename, enum parsedbflags flags, if (fstat(fd, &stat) == -1) ohshite(_("can't stat package info file `%.255s'"),filename); -#ifdef PARSE_MMAP +#ifdef HAVE_MMAP if ((dataptr= (char *)mmap(NULL, stat.st_size, PROT_READ, MAP_SHARED, fd, 0)) == MAP_FAILED) ohshite(_("can't mmap package info file `%.255s'"),filename); #else @@ -316,7 +317,7 @@ int parsedb(const char *filename, enum parsedbflags flags, if (c == '\n') lno++; } pop_cleanup(0); -#ifdef PARSE_MMAP +#ifdef HAVE_MMAP munmap(data, stat.st_size); #else free(data); -- 2.39.5