Function anj_persistence_magic
Defined in File persistence.h
Function Documentation
-
int anj_persistence_magic(const anj_persistence_context_t *ctx, const void *magic, size_t magic_size)
Writes or verifies a “magic” tag.
In STORE mode: writes
magicof sizemagic_size.In RESTORE mode: reads
magic_sizebytes and verifies they are identical tomagic.
Typical use is to guard persisted blobs with a short prefix describing the expected format/version.
- Parameters:
ctx – Persistence context.
magic – Pointer to expected/actual magic bytes.
magic_size – Number of bytes (<= ANJ_PERSISTENCE_MAGIC_MAX_SIZE).
- Returns:
0 on success, negative value on error or mismatch (RESTORE).