From: Martin Quinson Date: Thu, 2 Feb 2012 13:16:13 +0000 (+0100) Subject: merge two files (I'll ignore both of these functions anyway) X-Git-Tag: exp_20120216~91 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/566c37eac6ea944bcbee63778f267c64677f4ee9 merge two files (I'll ignore both of these functions anyway) --- diff --git a/src/xbt/mmalloc/mm.c b/src/xbt/mmalloc/mm.c index adc31bb646..4d3bbb819b 100644 --- a/src/xbt/mmalloc/mm.c +++ b/src/xbt/mmalloc/mm.c @@ -20,7 +20,6 @@ #include "mmalloc.c" #include "mmemalign.c" #include "mrealloc.c" -#include "mvalloc.c" #include "mmorecore.c" #include "attach.c" #include "detach.c" diff --git a/src/xbt/mmalloc/mmemalign.c b/src/xbt/mmalloc/mmemalign.c index 5c7fb24cdd..93ca53a2da 100644 --- a/src/xbt/mmalloc/mmemalign.c +++ b/src/xbt/mmalloc/mmemalign.c @@ -39,3 +39,19 @@ void *mmemalign(xbt_mheap_t mdp, size_t alignment, size_t size) } return (result); } + +/* Cache the pagesize for the current host machine. Note that if the host + does not readily provide a getpagesize() function, we need to emulate it + elsewhere, not clutter up this file with lots of kluges to try to figure + it out. */ +static size_t cache_pagesize; + +void *mvalloc(xbt_mheap_t mdp, size_t size) +{ + if (cache_pagesize == 0) { + cache_pagesize = getpagesize(); + } + + return (mmemalign(mdp, cache_pagesize, size)); +} + diff --git a/src/xbt/mmalloc/mvalloc.c b/src/xbt/mmalloc/mvalloc.c deleted file mode 100644 index c940ee9f69..0000000000 --- a/src/xbt/mmalloc/mvalloc.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Allocate memory on a page boundary. - Copyright (C) 1991 Free Software Foundation, Inc. */ - -/* Copyright (c) 2010. The SimGrid Team. - * All rights reserved. */ - -/* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ - - -#include "mmprivate.h" -#include - -/* Cache the pagesize for the current host machine. Note that if the host - does not readily provide a getpagesize() function, we need to emulate it - elsewhere, not clutter up this file with lots of kluges to try to figure - it out. */ - -static size_t cache_pagesize; -#if NEED_DECLARATION_GETPAGESIZE -extern int getpagesize PARAMS((void)); -#endif - -void *mvalloc(xbt_mheap_t mdp, size_t size) -{ - if (cache_pagesize == 0) { - cache_pagesize = getpagesize(); - } - - return (mmemalign(mdp, cache_pagesize, size)); -} -