5
Last change
on this file since 1ad43f8 was
1ad43f8,
checked in by Sebastian Huber <sebastian.huber@…>, on 09/13/18 at 12:49:16
|
Avoid need for -fno-builtin for calloc()
Use RTEMS_OBFUSCATE_VARIABLE() instead.
|
-
Property mode set to
100644
|
File size:
765 bytes
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Allocate Space for Array in Memory |
---|
5 | * @ingroup libcsupport |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-2014. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #if defined(RTEMS_NEWLIB) && !defined(HAVE_CALLOC) |
---|
22 | #include <stdlib.h> |
---|
23 | #include <string.h> |
---|
24 | #include <rtems/score/basedefs.h> |
---|
25 | |
---|
26 | void *calloc( |
---|
27 | size_t nelem, |
---|
28 | size_t elsize |
---|
29 | ) |
---|
30 | { |
---|
31 | char *cptr; |
---|
32 | size_t length; |
---|
33 | |
---|
34 | length = nelem * elsize; |
---|
35 | cptr = malloc( length ); |
---|
36 | RTEMS_OBFUSCATE_VARIABLE( cptr ); |
---|
37 | if ( cptr ) |
---|
38 | memset( cptr, '\0', length ); |
---|
39 | |
---|
40 | return cptr; |
---|
41 | } |
---|
42 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.