* @brief This function will contiguously allocate enough space for count objects * that are size bytes of memory each and returns a pointer to the allocated * memory. * * @note The allocated memory is filled with bytes of value zero. * * @param count is the number of objects to allocate. * * @param size is the size of one object to allocate. * * @return pointer to al
| 910 | * @return pointer to allocated memory / NULL pointer if there is an error. |
| 911 | */ |
| 912 | rt_weak void *rt_calloc(rt_size_t count, rt_size_t size) |
| 913 | { |
| 914 | void *p; |
| 915 | |
| 916 | /* allocate 'count' objects of size 'size' */ |
| 917 | p = rt_malloc(count * size); |
| 918 | /* zero the memory */ |
| 919 | if (p) |
| 920 | { |
| 921 | rt_memset(p, 0, count * size); |
| 922 | } |
| 923 | return p; |
| 924 | } |
| 925 | RTM_EXPORT(rt_calloc); |
| 926 | |
| 927 | /** |
no test coverage detected