| 1 |
|
| 2 |
# umockstring requirements |
| 3 |
|
| 4 |
# Overview |
| 5 |
|
| 6 |
umockstring is a module that provides the functionality of cloning a string (allocating memory and copying the chars). |
| 7 |
|
| 8 |
# Exposed API |
| 9 |
|
| 10 |
```c |
| 11 |
char* umockstring_clone(const char* source); |
| 12 |
``` |
| 13 |
|
| 14 |
## umockstring_clone |
| 15 |
|
| 16 |
```c |
| 17 |
char* umockstring_clone(const char* source); |
| 18 |
``` |
| 19 |
|
| 20 |
**UMOCK_STRING_01_001: [** `umockstring_clone` shall allocate memory for the cloned string (including the NULL terminator). **]** |
| 21 |
|
| 22 |
**UMOCK_STRING_01_002: [** `umockstring_clone` shall copy the string to the newly allocated memory (including the NULL terminator). **]** |
| 23 |
|
| 24 |
**UMOCK_STRING_01_003: [** On success `umockstring_clone` shall return a pointer to the newly allocated memory containing the copy of the string. **]** |
| 25 |
|
| 26 |
**UMOCK_STRING_01_004: [** If allocating the memory fails, `umockstring_clone` shall return NULL. **]** |
| 27 |
|
| 28 |
**UMOCK_STRING_01_005: [** If `umockstring_clone` is called with a NULL `source`, it shall return NULL. **]** |