Debian Codegraph @

src/vendor/azure-uamqp-c/deps/umock-c/devdoc/umockalloc_requirements.md

raw
1 # umockalloc requirements
2
3 # Overview
4
5 umockalloc is a module that wraps the C memory allocation functions (malloc, calloc, realloc and free).
6 This is so that umock_c can control what code is executed for allocation and there are no undesired redefinitions of malloc/calloc/realloc/free.
7
8 # Exposed API
9
10 ```c
11 void* umockalloc_malloc(size_t size);
12 void* umockalloc_calloc(size_t nmemb, size_t size);
13 void* umockalloc_realloc(void* ptr, size_t size);
14 void umockalloc_free(void* ptr);
15 ```
16
17 ## umockalloc_malloc
18
19 ```c
20 void* umockalloc_malloc(size_t size);
21 ```
22
23 **SRS_UMOCKALLOC_01_001: [** umockalloc_malloc shall call malloc, while passing the size argument to malloc. **]**
24
25 **SRS_UMOCKALLOC_01_002: [** umockalloc_malloc shall return the result of malloc. **]**
26
27 ## umockalloc_calloc
28
29 ```c
30 void* umockalloc_calloc(size_t nmemb, size_t size);
31 ```
32
33 **SRS_UMOCKALLOC_09_001: [** umockalloc_calloc shall call calloc, while passing the number of members and size arguments to calloc. **]**
34
35 **SRS_UMOCKALLOC_09_002: [** umockalloc_calloc shall return the result of calloc. **]**
36
37 ## umockalloc_realloc
38
39 ```c
40 void* umockalloc_realloc(void* ptr, size_t size);
41 ```
42
43 **SRS_UMOCKALLOC_01_003: [** umockalloc_realloc shall call realloc, while passing the ptr and size arguments to realloc. **]**
44
45 **SRS_UMOCKALLOC_01_004: [** umockalloc_realloc shall return the result of realloc. **]**
46
47 ## umockalloc_free
48
49 ```c
50 void umockalloc_free(void* ptr);
51 ```
52
53 **SRS_UMOCKALLOC_01_005: [** umockalloc_free shall call free, while passing the ptr argument to free. **]**