fix config file path
[AROS.git] / compiler / clib / calloc.c
blob66048f62641e5dc6f8091ae6cee1da22f996a3d7
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 C99 function calloc().
6 */
8 #include <exec/types.h>
9 #include <string.h>
11 /*****************************************************************************
13 NAME */
14 #include <stdlib.h>
16 void * calloc (
18 /* SYNOPSIS */
19 size_t count,
20 size_t size)
22 /* FUNCTION
23 Allocate size bytes of memory, clears the memory (sets all bytes to
24 0) and returns the address of the first byte.
26 INPUTS
27 count - How many time size
28 size - How much memory to allocate.
30 RESULT
31 A pointer to the allocated memory or NULL. If you don't need the
32 memory anymore, you can pass this pointer to free(). If you don't,
33 the memory will be freed for you when the application exits.
35 NOTES
36 This function must not be used in a shared library or
37 in a threaded application.
39 EXAMPLE
41 BUGS
43 SEE ALSO
44 free(), malloc()
46 INTERNALS
48 ******************************************************************************/
50 ULONG * mem;
52 size *= count;
54 /* Allocate the memory */
55 mem = malloc (size);
57 if (mem)
58 memset (mem, 0, size);
60 return mem;
61 } /* calloc */