|
cbase 1.50.0
C/C++ Static Template
|
Wrappers around string.h functions that force sizeof() safety. More...
Macros | |
| #define | MEM_ZERO(ptr, size) |
| Zeroes a block of memory. Wraps memset. | |
| #define | MEM_ZERO_STRUCT(ptr) |
| Zeroes an entire struct via its pointer. | |
| #define | MEM_ZERO_ARRAY(arr) |
| Zeroes an entire static array. | |
| #define | MEM_COPY(dst, src, size) |
| Copies memory using memmove (overlap-safe). | |
| #define | MEM_COPY_STRUCT(dst, src) |
| Copies one struct into another, clamping to the smaller size. | |
| #define | MEM_COPY_ARRAY(dst, src) |
| Copies one static array into another, clamping to the smaller size. | |
Wrappers around string.h functions that force sizeof() safety.
| #define MEM_COPY | ( | dst, | |
| src, | |||
| size ) |
Copies memory using memmove (overlap-safe).
Definition at line 576 of file base_macros.h.
| #define MEM_COPY_ARRAY | ( | dst, | |
| src ) |
Copies one static array into another, clamping to the smaller size.
Example:
| dst | Destination array. |
| src | Source array. |
Definition at line 609 of file base_macros.h.
| #define MEM_COPY_STRUCT | ( | dst, | |
| src ) |
Copies one struct into another, clamping to the smaller size.
Safe even if the structs are different sizes — copies only up to min(sizeof(*dst), sizeof(*src)) bytes, preventing overflow.
Example:
| dst | Pointer to the destination struct. |
| src | Pointer to the source struct. |
Definition at line 594 of file base_macros.h.
| #define MEM_ZERO | ( | ptr, | |
| size ) |
Zeroes a block of memory. Wraps memset.
Definition at line 547 of file base_macros.h.
| #define MEM_ZERO_ARRAY | ( | arr | ) |
Zeroes an entire static array.
Example:
| arr | The statically allocated array (not a pointer). |
Definition at line 573 of file base_macros.h.
| #define MEM_ZERO_STRUCT | ( | ptr | ) |
Zeroes an entire struct via its pointer.
Example:
| ptr | Pointer to the struct. |
Definition at line 560 of file base_macros.h.