docs(memory management): added return type to functions in memory management docs

This commit is contained in:
Mineplay 2025-04-19 09:02:35 -05:00
parent 89f8f2b5c4
commit 6b3e24c210

View file

@ -25,10 +25,17 @@ Sets specified block of memory to specified value.
HallocyError hallocy_set_memory(void *destination, int value, const size_t size); HallocyError hallocy_set_memory(void *destination, int value, const size_t size);
``` ```
**Args**:
- `destination`: The memory to set the value of. - `destination`: The memory to set the value of.
- `value`: The value to set the memory in destination to. - `value`: The value to set the memory in destination to.
- `size`: The size of the memory in bytes to set the value of. - `size`: The size of the memory in bytes to set the value of.
**Returns**:
- **HALLOCY_ERROR_NONE**: Successfully set memory.
- **HALLOCY_ERROR_INVALID_POINTER**: Invalid pointer was given.
### Copy memory ### Copy memory
Copies memory from one pointer to another pointer. Copies memory from one pointer to another pointer.
@ -37,10 +44,17 @@ Copies memory from one pointer to another pointer.
HallocyError hallocy_copy_memory(void *destination, void *source, const size_t size); HallocyError hallocy_copy_memory(void *destination, void *source, const size_t size);
``` ```
**Args**:
- `destination`: The memory to copy the values to. - `destination`: The memory to copy the values to.
- `source`: The memory to copy the values from. - `source`: The memory to copy the values from.
- `size`: The size of the memory in bytes to copy the value to. - `size`: The size of the memory in bytes to copy the value to.
**Returns**:
- **HALLOCY_ERROR_NONE**: Successfully copied memory.
- **HALLOCY_ERROR_INVALID_POINTER**: Invalid pointers where given.
### Move memory ### Move memory
Copies memory from one pointer to another pointer. Unlike the `hallocy_copy_memory` function this function will handle overlapping memory right. Copies memory from one pointer to another pointer. Unlike the `hallocy_copy_memory` function this function will handle overlapping memory right.
@ -49,20 +63,31 @@ Copies memory from one pointer to another pointer. Unlike the `hallocy_copy_memo
HallocyError hallocy_move_memory(void *destination, void *source, const size_t size); HallocyError hallocy_move_memory(void *destination, void *source, const size_t size);
``` ```
**Args**:
- `destination`: The memory to copy the values to. - `destination`: The memory to copy the values to.
- `source`: The memory to copy the values from. - `source`: The memory to copy the values from.
- `size`: The size of the memory in bytes to copy the value to. - `size`: The size of the memory in bytes to copy the value to.
**Returns**:
- **HALLOCY_ERROR_NONE**: Successfully moved memory.
- **HALLOCY_ERROR_INVALID_POINTER**: Invalid pointers where given.
### Compare memory ### Compare memory
```c ```c
bool hallocy_compare_memory(void *left_side, void *right_side, const size_t size); bool hallocy_compare_memory(void *left_side, void *right_side, const size_t size);
``` ```
**Args**:
- `left_side`: The memory to compare with the right side. - `left_side`: The memory to compare with the right side.
- `right_side`: The memory to compare with the left side. - `right_side`: The memory to compare with the left side.
- `size`: The size of the memory in bytes to compare the value to. - `size`: The size of the memory in bytes to compare the value to.
**Returns**: True if both pointers contain same content, else returns false.
## Example usage ## Example usage
```c ```c