Low-level memory operations.
More...
|
| void | ft_bzero (void *s, size_t n) |
| | Sets n bytes of memory to zero.
|
| |
| void * | ft_memchr (const void *s, int c, size_t n) |
| | Locates the first occurrence of a byte in memory.
|
| |
| int | ft_memcmp (const void *s1, const void *s2, size_t n) |
| | Compares two memory areas byte by byte.
|
| |
| void * | ft_memcpy (void *dst, const void *src, size_t n) |
| | Copies n bytes from src to dst.
|
| |
| void * | ft_memmove (void *dst, const void *src, size_t len) |
| | Copies n bytes from src to dst, handling overlapping memory.
|
| |
| void * | ft_memset (void *b, int c, size_t len) |
| | Fills memory with a constant byte.
|
| |
Low-level memory operations.
Functions to manipulate raw memory blocks.
◆ ft_bzero()
| void ft_bzero |
( |
void * |
s, |
|
|
size_t |
n |
|
) |
| |
Sets n bytes of memory to zero.
- Parameters
-
| s | Pointer to memory area. |
| n | Number of bytes to set. |
◆ ft_memchr()
| void * ft_memchr |
( |
const void * |
s, |
|
|
int |
c, |
|
|
size_t |
n |
|
) |
| |
Locates the first occurrence of a byte in memory.
- Note
- Returned pointer is borrowed from s. Do not free it directly.
- Parameters
-
| s | Memory area to search (borrowed). |
| c | Byte to search for (converted to unsigned char). |
| n | Number of bytes to search. |
- Returns
- Pointer to the byte (borrowed), or NULL if not found.
◆ ft_memcmp()
| int ft_memcmp |
( |
const void * |
s1, |
|
|
const void * |
s2, |
|
|
size_t |
n |
|
) |
| |
Compares two memory areas byte by byte.
- Parameters
-
| s1 | First memory area. |
| s2 | Second memory area. |
| n | Number of bytes to compare. |
- Returns
- Difference of first differing bytes, or 0 if equal.
◆ ft_memcpy()
| void * ft_memcpy |
( |
void * |
dst, |
|
|
const void * |
src, |
|
|
size_t |
n |
|
) |
| |
Copies n bytes from src to dst.
- Warning
- Memory areas must not overlap. Use ft_memmove for overlapping.
- Parameters
-
| dst | Destination memory area (borrowed). |
| src | Source memory area (borrowed). |
| n | Number of bytes to copy. |
- Returns
- Pointer to dst.
◆ ft_memmove()
| void * ft_memmove |
( |
void * |
dst, |
|
|
const void * |
src, |
|
|
size_t |
len |
|
) |
| |
Copies n bytes from src to dst, handling overlapping memory.
- Parameters
-
| dst | Destination memory area. |
| src | Source memory area. |
| len | Number of bytes to copy. |
- Returns
- Pointer to dst.
◆ ft_memset()
| void * ft_memset |
( |
void * |
b, |
|
|
int |
c, |
|
|
size_t |
len |
|
) |
| |
Fills memory with a constant byte.
- Parameters
-
| b | Memory area to fill. |
| c | Byte value to set (converted to unsigned char). |
| len | Number of bytes to set. |
- Returns
- Pointer to b.