Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
[simgrid.git] / src / xbt / mmalloc / mcalloc.c
1 /* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
2    This file was then part of the GNU C Library. */
3
4 /* Copyright (c) 2010. The SimGrid Team.
5  * All rights reserved.                                                     */
6
7 /* This program is free software; you can redistribute it and/or modify it
8  * under the terms of the license (GNU LGPL) which comes with this package. */
9
10 #include <sys/types.h>          /* GCC on HP/UX needs this before string.h. */
11 #include <string.h>             /* Prototypes for memcpy, memmove, memset, etc */
12
13 #include "mmprivate.h"
14
15 /* Allocate an array of NMEMB elements each SIZE bytes long.
16    The entire array is initialized to zeros.  */
17
18 void *mcalloc(xbt_mheap_t md, register size_t nmemb, register size_t size)
19 {
20   register void *result;
21
22   if ((result = mmalloc(md, nmemb * size)) != NULL) {
23     memset(result, 0, nmemb * size);
24   }
25   return (result);
26 }