OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [newlib-1.18.0/] [newlib-1.18.0-or32-1.0rc1/] [newlib/] [libc/] [stdlib/] [calloc.c] - Diff between revs 207 and 345

Only display areas with differences | Details | Blame | View Log

Rev 207 Rev 345
#ifdef MALLOC_PROVIDED
#ifdef MALLOC_PROVIDED
int _dummy_calloc = 1;
int _dummy_calloc = 1;
#else
#else
/*
/*
FUNCTION
FUNCTION
<<calloc>>---allocate space for arrays
<<calloc>>---allocate space for arrays
 
 
INDEX
INDEX
        calloc
        calloc
 
 
INDEX
INDEX
        _calloc_r
        _calloc_r
 
 
ANSI_SYNOPSIS
ANSI_SYNOPSIS
        #include <stdlib.h>
        #include <stdlib.h>
        void *calloc(size_t <[n]>, size_t <[s]>);
        void *calloc(size_t <[n]>, size_t <[s]>);
        void *_calloc_r(void *<[reent]>, size_t <[n]>, size_t <[s]>);
        void *_calloc_r(void *<[reent]>, size_t <[n]>, size_t <[s]>);
 
 
TRAD_SYNOPSIS
TRAD_SYNOPSIS
        #include <stdlib.h>
        #include <stdlib.h>
        char *calloc(<[n]>, <[s]>)
        char *calloc(<[n]>, <[s]>)
        size_t <[n]>, <[s]>;
        size_t <[n]>, <[s]>;
 
 
        char *_calloc_r(<[reent]>, <[n]>, <[s]>)
        char *_calloc_r(<[reent]>, <[n]>, <[s]>)
        char *<[reent]>;
        char *<[reent]>;
        size_t <[n]>;
        size_t <[n]>;
        size_t <[s]>;
        size_t <[s]>;
 
 
 
 
 
 
DESCRIPTION
DESCRIPTION
Use <<calloc>> to request a block of memory sufficient to hold an
Use <<calloc>> to request a block of memory sufficient to hold an
array of <[n]> elements, each of which has size <[s]>.
array of <[n]> elements, each of which has size <[s]>.
 
 
The memory allocated by <<calloc>> comes out of the same memory pool
The memory allocated by <<calloc>> comes out of the same memory pool
used by <<malloc>>, but the memory block is initialized to all zero
used by <<malloc>>, but the memory block is initialized to all zero
bytes.  (To avoid the overhead of initializing the space, use
bytes.  (To avoid the overhead of initializing the space, use
<<malloc>> instead.)
<<malloc>> instead.)
 
 
The alternate function <<_calloc_r>> is reentrant.
The alternate function <<_calloc_r>> is reentrant.
The extra argument <[reent]> is a pointer to a reentrancy structure.
The extra argument <[reent]> is a pointer to a reentrancy structure.
 
 
RETURNS
RETURNS
If successful, a pointer to the newly allocated space.
If successful, a pointer to the newly allocated space.
 
 
If unsuccessful, <<NULL>>.
If unsuccessful, <<NULL>>.
 
 
PORTABILITY
PORTABILITY
<<calloc>> is ANSI.
<<calloc>> is ANSI.
 
 
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/
*/
 
 
#include <string.h>
#include <string.h>
#include <stdlib.h>
#include <stdlib.h>
 
 
#ifndef _REENT_ONLY
#ifndef _REENT_ONLY
 
 
_PTR
_PTR
_DEFUN (calloc, (n, size),
_DEFUN (calloc, (n, size),
        size_t n _AND
        size_t n _AND
        size_t size)
        size_t size)
{
{
  return _calloc_r (_REENT, n, size);
  return _calloc_r (_REENT, n, size);
}
}
 
 
#endif
#endif
#endif /* MALLOC_PROVIDED */
#endif /* MALLOC_PROVIDED */
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.