Function anj_persistence_magic

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 magic of size magic_size.

  • In RESTORE mode: reads magic_size bytes and verifies they are identical to magic.

Typical use is to guard persisted blobs with a short prefix describing the expected format/version.

Parameters:
Returns:

0 on success, negative value on error or mismatch (RESTORE).